/* ============================================================================
   INVENTRA MODERN UI SYSTEM
   Clean, Professional, Interactive Design System
   ============================================================================ */

:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --primary-50: #eff6ff;
    
    /* Secondary Colors */
    --secondary: #7c3aed;
    --secondary-light: #a78bfa;
    --accent: #06b6d4;
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gray-950: #030712;
    
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    
    /* Border & Shadows */
    --border-color: #e5e7eb;
    --border-radius: 0.5rem;
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   LAYOUT SHELL
   ============================================================================ */

.layout-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

/* SIDEBAR STYLES */
.sidebar {
    width: 260px;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: var(--text-inverse);
    padding: 20px;
    overflow-y: auto;
    transition: width var(--transition-base), padding var(--transition-base);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 100;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar.collapsed {
    width: 80px;
    padding: 16px 8px;
}

.sidebar h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 24px;
    padding: 0 8px;
    letter-spacing: -0.5px;
    color: var(--text-inverse);
}

.sidebar-section {
    margin-bottom: 28px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 12px;
    margin-bottom: 8px;
    display: block;
}

.sidebar.collapsed .sidebar-section-title {
    display: none;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 12px;
    border-radius: var(--border-radius);
    text-decoration: none;
    margin-bottom: 6px;
    transition: all var(--transition-fast);
    position: relative;
    font-weight: 500;
    font-size: 13px;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
    padding-left: 14px;
}

.sidebar a.active {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: inset -2px 0 0 var(--primary-dark);
}

.sidebar a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--text-inverse);
    border-radius: 0 2px 2px 0;
}

.sidebar.collapsed a {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed a .s-label {
    display: none;
}

.sidebar.collapsed a .s-icon {
    display: inline-block;
    margin: 0;
}

.s-icon {
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: var(--text-inverse);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar.collapsed .badge {
    display: none;
}

#sidebar-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

#sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
}

/* CONTENT WRAP */
.content-wrap {
    flex: 1;
    padding: 20px;
    background-color: var(--bg-secondary);
    overflow-y: auto;
}

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border-radius: var(--border-radius);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-fast), height var(--transition-fast);
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--text-inverse);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-50);
}

/* Danger Button */
.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Size Variants */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 20px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.form-control,
.form-control input,
.form-control select,
.form-control textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.form-control:focus,
.form-control input:focus,
.form-control select:focus,
.form-control textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.form-control input::placeholder,
.form-control textarea::placeholder {
    color: var(--text-tertiary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ============================================================================
   ALERT & NOTIFICATION
   ============================================================================ */

.alert {
    padding: 14px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 4px solid;
    animation: slideInDown var(--transition-base);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-color: var(--success);
}

.alert-error,
.alert-danger {
    background: var(--danger-light);
    color: #7f1d1d;
    border-color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: #78350f;
    border-color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
    border-color: var(--info);
}

.alert-title {
    font-weight: 700;
    margin-bottom: 4px;
}

/* ============================================================================
   CARD & PANEL
   ============================================================================ */

.card,
.panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover,
.panel:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ============================================================================
   TABLES
   ============================================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table thead {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.table-striped tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary);
}

/* ============================================================================
   BADGES & LABELS
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-danger {
    background: var(--danger-light);
    color: #7f1d1d;
}

.badge-warning {
    background: var(--warning-light);
    color: #78350f;
}

.badge-info {
    background: var(--info-light);
    color: #1e40af;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ============================================================================
   TABS
   ============================================================================ */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ============================================================================
   KPI & METRICS
   ============================================================================ */

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.kpi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.kpi:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================================================
   MODALS & DIALOGS
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    animation: slideUp var(--transition-base);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 16px 8px;
    }
    
    .sidebar h2,
    .sidebar .s-label {
        display: none;
    }
    
    .sidebar a {
        justify-content: center;
    }
    
    .kpi-strip {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

@media (max-width: 768px) {
    .layout-shell {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 12px;
        display: flex;
        gap: 8px;
        overflow-x: auto;
    }
    
    .sidebar h2 {
        display: none;
    }
    
    .sidebar a {
        flex-shrink: 0;
    }
    
    .content-wrap {
        padding: 16px;
    }
    
    .topbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .kpi-strip {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar {
        gap: 4px;
        padding: 8px;
    }
    
    .sidebar a {
        padding: 8px;
        gap: 8px;
        font-size: 11px;
    }
    
    .card,
    .panel {
        padding: 16px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .modal {
        width: 95%;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mt-6 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.mb-6 { margin-bottom: 32px; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-tertiary); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 24px; }

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

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

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

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

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.rounded {
    border-radius: var(--border-radius);
}

.shadow {
    box-shadow: var(--shadow-md);
}

.opacity-50 {
    opacity: 0.5;
}

.hidden {
    display: none !important;
}

.block {
    display: block !important;
}

/* ============================================================================
   LOADING & TRANSITIONS
   ============================================================================ */

.spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn var(--transition-base);
}

.fade-out {
    animation: fadeOut var(--transition-base);
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .sidebar,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .content-wrap {
        padding: 0;
        background: white;
    }
}
