/* Metamorphic Light Theme Design System (Tailwind Compatible) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-page: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-sidebar: #ffffff;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-subtle: rgba(226, 232, 240, 0.8);
    --border-hover: rgba(99, 102, 241, 0.3);

    --primary-gradient: linear-gradient(135deg, #4f46e5, #6366f1);
    --primary-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.35);

    --meta-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.05), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
    --meta-shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --inset-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.06), transparent 35%),
        radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.06), transparent 35%);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a {
    color: #4f46e5;
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #4338ca;
}

/* App Wrapper Layout */
.app-wrapper {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 270px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #ffffff;
    box-shadow: var(--primary-shadow);
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.sidebar-nav {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    padding: 14px 14px 6px 14px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(241, 245, 249, 0.8);
    color: var(--text-main);
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #4f46e5;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* User Profile Badge in Sidebar */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(248, 250, 252, 0.6);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #ffffff;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-superadmin {
    background: #f3e8ff;
    color: #9333ea;
    border: 1px solid #e9d5ff;
}

.role-staff {
    background: #e0e7ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

/* Main Content Container */
.main-content {
    margin-left: 270px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Navbar */
.top-header {
    height: 74px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.015);
}

.header-title h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Content Viewport */
.content-body {
    padding: 36px;
    flex: 1;
}

/* Metamorphic Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--meta-shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--meta-shadow-hover);
    border-color: rgba(99, 102, 241, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--meta-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--meta-shadow-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.indigo { background: #e0e7ff; color: #4f46e5; }
.stat-icon.emerald { background: #dcfce7; color: #16a34a; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }

.stat-info .stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.stat-info .stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}

/* UI Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--primary-shadow);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -5px rgba(99, 102, 241, 0.45);
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-danger {
    background: #ffe4e6;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.btn-danger:hover {
    background: #fecdd3;
    color: #be123c;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 10px;
}

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.data-table th {
    padding: 14px 20px;
    background: rgba(248, 250, 252, 0.8);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-weight: 500;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(241, 245, 249, 0.6);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; }
.badge-contacted { background: #f3e8ff; color: #9333ea; border: 1px solid #e9d5ff; }
.badge-qualified { background: #e0e7ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.badge-proposal { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.badge-won { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-lost { background: #ffe4e6; color: #e11d48; border: 1px solid #fecdd3; }

.badge-active { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-inactive { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    box-shadow: var(--inset-shadow);
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #ffe4e6; color: #be123c; border: 1px solid #fecdd3; }
.alert-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    width: 100%;
    max-width: 580px;
    padding: 36px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.modal-close {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

/* Auth Cards (Login) */
.auth-wrapper {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12), transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.12), transparent 40%),
                #f8fafc;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 44px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 28px;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.1);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-badge {
    margin: 0 auto 16px auto;
    width: 60px;
    height: 60px;
    font-size: 26px;
    border-radius: 18px;
}

.auth-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 6px;
}
