/* 
   Magni Portal V2 - Premium Enterprise Theme
   Style: Clean, Light, Minimal, "Stripe-like"
   Updated: Premium Polish Phase
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Base Colors - Professional Light Theme */
    --bg-body: #f3f4f6;
    /* Gray 100 */
    --bg-surface: #ffffff;
    /* Pure White */

    /* Text Colors */
    --text-primary: #111827;
    /* Hex Gray 900 */
    --text-secondary: #4b5563;
    /* Hex Gray 600 - Darkened for contrast */
    --text-tertiary: #9ca3af;
    /* Hex Gray 400 */

    /* Brand Colors */
    --primary: #2563eb;
    /* Blue 600 */
    --primary-hover: #1d4ed8;
    /* Blue 700 */
    --primary-light: #eff6ff;
    /* Blue 50 */
    --primary-ring: rgba(37, 99, 235, 0.2);
    /* Focus ring color */

    /* Status Colors */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-ring: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;

    /* Borders & Shadows */
    --border: #e5e7eb;
    /* Gray 200 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-pop: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Dimensions */
    --radius: 12px;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* {
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.15s ease-in-out;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 101;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.02);
    /* Subtle separation */
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-section {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.925rem;
    margin-bottom: 4px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.nav-item i {
    width: 24px;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-body);
    color: var(--text-primary);
}

.nav-item:hover i {
    color: var(--text-secondary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-color: rgba(37, 99, 235, 0.1);
}

.nav-item.active i {
    color: var(--primary);
}

.user-profile {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.page-title {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.content-body {
    padding: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Components --- */

/* Premium Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-pop);
    transform: translateY(-2px);
    border-color: #d1d5db;
}

/* Form Elements */
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

input::placeholder {
    color: #d1d5db;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.925rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border-color: var(--border);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: #d1d5db;
    color: var(--text-primary);
}

.btn-danger {
    background: white;
    border-color: #fecaca;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.025em;
}

.bg-green-50 {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.bg-yellow-50 {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.1);
}

.bg-red-50 {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.bg-blue-50 {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.1);
}

/* --- Modals --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.7);
    /* Darker overlay */
    backdrop-filter: blur(4px);
    /* Blur effect */
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

/* Active state managed by JS (display: flex) + animation trigger */
.overlay.active {
    display: flex;
    opacity: 1;
}

.overlay .card {
    background: white;
    box-shadow: var(--shadow-modal);
    border: none;
    width: 100%;
    max-width: 550px;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy pop effect */
    max-height: 90vh;
    overflow-y: auto;
}

.overlay.active .card {
    transform: scale(1);
    opacity: 1;
}

/* Utilities */
.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-muted {
    color: #9ca3af;
}

.font-bold {
    font-weight: 700;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.w-full {
    width: 100%;
}

/* Mobile */
.mobile-toggle {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
        margin-right: 1rem;
        font-size: 1.25rem;
        cursor: pointer;
        color: var(--text-secondary);
    }

    .content-body {
        padding: 1.25rem;
    }

    .header {
        padding: 0 1.25rem;
    }
}