/* ElectroVente Custom Styles */

:root {
    --primary-color: #1e4a6b;
    --secondary-color: #2c5f7e;
    --accent-color: #f39c12;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-bg: #f5f7fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-sm: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --border-radius: 0.75rem;
    --transition: all 0.3s ease;
    --gradient-primary: linear-gradient(135deg, #1e4a6b 0%, #2c5f7e 100%);
    --gradient-accent: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Custom Bootstrap Colors */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 74, 107, 0.3);
}

.btn-warning {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
    border-color: #e67e22;
    color: white;
    transform: translateY(-1px);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--gradient-primary);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.navbar-logo {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
}

.mini-laptop {
    position: relative;
    width: 28px;
    height: 21px;
}

.mini-screen {
    width: 28px;
    height: 16px;
    background: white;
    border-radius: 3px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.mini-keyboard {
    width: 32px;
    height: 5px;
    background: white;
    border-radius: 0 0 4px 4px;
    position: absolute;
    bottom: 0;
    left: -2px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-top: none;
}

.mini-cart {
    position: absolute;
    top: 4px;
    left: 10px;
    color: #f39c12;
    font-size: 10px;
    animation: bounce 2s infinite;
}

.brand-text h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-text small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-color);
}

.sidebar-menu .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--accent-color);
    font-weight: 600;
}

.sidebar-menu .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.logout-btn .btn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Header */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gradient-primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-brand {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    min-height: 100vh;
    padding-top: 0;
    transition: margin-left 0.3s ease;
}

.main-content.with-sidebar {
    margin-left: 280px;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content.with-sidebar {
        margin-left: 0;
        padding-top: 70px;
    }
    
    .mobile-header {
        display: flex;
    }
}

.nav-link {
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    transform: translateY(-1px);
}

.nav-link.active {
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 0.5rem;
}

/* Remove old main content styles - replaced by sidebar styles above */

/* Cards */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: none;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: none;
    font-weight: 600;
    padding: 1.25rem;
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(135deg, var(--white) 0%, #f8f9fa 100%);
    transition: var(--transition);
}

.stats-card:hover {
    background: linear-gradient(135deg, var(--white) 0%, #e9ecef 100%);
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-right: 1rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stats-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Action Cards */
.action-card {
    transition: var(--transition);
    background: linear-gradient(135deg, var(--white) 0%, #f8f9fa 100%);
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--white) 0%, #e9ecef 100%);
}

.action-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(30, 74, 107, 0.05);
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 1rem 0.75rem;
}

.table-primary {
    background-color: var(--primary-color);
    color: white;
}

.table-primary th {
    border-bottom-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Forms */
.form-control {
    border-radius: 0.5rem;
    border: 1.5px solid #e9ecef;
    transition: var(--transition);
    padding: 0.75rem 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(30, 74, 107, 0.25);
}

.form-label {
    display: block !important;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

/* Force labels to be visible in all contexts - CRITICAL FIX */
/* EXCEPT floating labels which have their own positioning */
.modal label:not(.input-label):not(.form-check-label),
.card label:not(.input-label):not(.form-check-label),
form label:not(.input-label):not(.form-check-label),
label.form-label,
.mb-3 label:not(.input-label):not(.form-check-label),
.col-md-6 label:not(.input-label):not(.form-check-label),
.col-md-3 label:not(.input-label):not(.form-check-label),
.col-md-2 label:not(.input-label):not(.form-check-label),
.modal-body label:not(.input-label):not(.form-check-label) {
    display: block !important;
    font-weight: 600 !important;
    color: #212529 !important;
    margin-bottom: 0.5rem !important;
    font-size: 14px !important;
    visibility: visible !important;
    opacity: 1 !important;
    line-height: 1.5 !important;
    position: relative !important;
    background: transparent !important;
    z-index: 1 !important;
}

/* Floating labels keep their special positioning */
.input-label {
    /* Don't override position for floating labels */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Additional specificity for form labels in modals */
#addStockModal label,
#editStockModal label,
#addEmployeeModal label,
#editEmployeeModal label {
    display: block !important;
    color: #212529 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
}

/* Modals */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid rgba(30, 74, 107, 0.1);
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(30, 74, 107, 0.1);
    padding: 1.5rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    border-width: 1.5px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-group .btn {
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Search */
.search-container {
    position: relative;
}

.search-container .form-control {
    padding-left: 2.75rem;
    background-color: white;
}

.search-container::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 10;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Alert Improvements */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

/* Invoice Items */
.invoice-item {
    background: linear-gradient(135deg, var(--white) 0%, #f8f9fa 100%);
    transition: var(--transition);
}

.invoice-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-number {
        font-size: 1.5rem;
    }
    
    .stats-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .action-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .modal-dialog {
        margin: 1rem 0.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .modal,
    .alert {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1a1a1a;
        --white: #2d2d2d;
        --text-dark: #ffffff;
        --text-muted: #a0a0a0;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--primary-color);
    }
    
    .btn-primary {
        border-width: 2px;
    }
}

/* Signature Canvas */
.signature-container {
    border: 2px dashed var(--primary-color);
    border-radius: 0.5rem;
    background-color: #ffffff;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.signature-canvas {
    width: 100%;
    height: 200px;
    cursor: crosshair;
    touch-action: none;
    background-color: #ffffff;
    border-radius: 0.25rem;
}

.signature-canvas:active {
    cursor: grabbing;
}
