/* ============================================
   SPCL ERP - Shared Components
   ============================================ */

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    outline: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-magenta));
    color: white;
    box-shadow: 0 4px 12px rgba(156,57,147,0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(156,57,147,0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--light-purple);
    color: var(--primary-purple);
    border: 1.5px solid rgba(156,57,147,0.2);
}

.btn-secondary:hover {
    background: rgba(156,57,147,0.15);
    border-color: var(--primary-purple);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10B981);
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16,185,129,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #DC2626, #EF4444);
    color: white;
}

.btn-warning {
    background: var(--warning-light);
    color: #92400E;
    border: 1.5px solid rgba(245,158,11,0.3);
}

.btn-warning:hover {
    background: #FDE68A;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--gray-200);
}

.btn-ghost:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .navbar {
    background: var(--bg-secondary);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: var(--light-purple);
    padding: 4px;
}

.navbar-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary-purple);
}

.navbar-subtitle {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.navbar-menu li a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.navbar-menu li a:hover {
    background: var(--light-purple);
    color: var(--primary-purple);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.language-selector select {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    background: white;
    color: var(--text-secondary);
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--light-purple);
    color: var(--primary-purple);
}

@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    
    .navbar-toggle {
        display: flex;
    }
    
    .language-selector {
        display: none;
    }
}

/* ============================================
   PAGE LOADER
   ============================================ */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hide {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   MODALS
   ============================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: slideInUp 0.3s ease;
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--gray-100);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: var(--error-light);
    color: var(--error);
}

.modal-body {
    padding: 1.5rem;
}

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

/* ============================================
   NOTIFICATIONS
   ============================================ */

#notificationContainer {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.notification-toast {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.3s ease;
    cursor: pointer;
    max-width: 100%;
}

.toast-success {
    background: #065F46;
    color: white;
}

.toast-error {
    background: #991B1B;
    color: white;
}

.toast-warning {
    background: #92400E;
    color: white;
}

.toast-info {
    background: #1E40AF;
    color: white;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--gray-200);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

[data-theme="dark"] .data-table thead th {
    background: var(--bg-tertiary);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

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

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
}

/* ============================================
   SIDEBAR (ERP)
   ============================================ */

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--dark-purple), #3D1539);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    padding: 4px;
    object-fit: contain;
}

.sidebar-brand {
    font-weight: 800;
    font-size: 1rem;
}

.sidebar-sub {
    font-size: 0.7rem;
    opacity: 0.7;
}

.sidebar-menu {
    padding: 0.75rem 0;
}

.sidebar-section {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.4);
    font-weight: 700;
    margin-top: 0.5rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-item.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--primary-magenta);
    font-weight: 600;
}

.sidebar-item i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.sidebar-item .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
}

/* Main content area when sidebar is present */
.main-with-sidebar {
    margin-left: 260px;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.main-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-content {
    padding: 1.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-with-sidebar {
        margin-left: 0;
    }
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
}

.pagination-btn.active {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
}

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

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-tertiary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-primary);
}

.tab-btn:hover {
    color: var(--primary-purple);
}

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

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

@media print {
    body {
        background: white !important;
    }
    
    .sidebar, .navbar, .main-header, .whatsapp-btn, .btn, .no-print {
        display: none !important;
    }
    
    .main-with-sidebar {
        margin-left: 0 !important;
    }
    
    .card, .data-section {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}
