/* Custom Styles for Lonestar Customer Portal */

/* Custom CSS Variables */
:root {
    --brand-primary: #2563eb;
    --brand-secondary: #7c3aed;
    --neutral-100: #f5f5f5;
    --neutral-200: #e5e5e5;
    --neutral-300: #d4d4d4;
    --neutral-400: #a3a3a3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius-small: 4px;
    --radius: 8px;
    --radius-lg: 12px;
}

/* Typography */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
}

/* Navigation Styles */
.nav-link {
    color: var(--neutral-600);
    transition: all 0.3s ease;
    position: relative;
    border-radius: 8px;
    margin: 2px 0;
}

.nav-link:hover {
    color: var(--brand-primary);
    background-color: var(--neutral-100);
    transform: translateX(4px);
}

.nav-link.active {
    color: var(--brand-primary);
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--brand-primary);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 0 3px 3px 0;
}

/* Improve sidebar animations */
#sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Smooth overlay transitions */
#sidebarOverlay {
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

/* User Dropdown Styles - Consolidated */
#userMenu {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
    max-height: 500px;
    overflow-y: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: all 0.2s ease;
    display: block;
}

#userMenu .hover\:bg-red-50:hover {
    background-color: rgba(254, 242, 242, 1);
}

/* Logout button specific styles */
#userMenu button[onclick*="logout"] {
    color: var(--danger) !important;
    border: none;
    background: transparent;
}

#userMenu button[onclick*="logout"]:hover {
    background-color: rgba(254, 242, 242, 1) !important;
    color: #dc2626 !important;
}

/* Ensure text-danger class works */
.text-danger {
    color: var(--danger) !important;
}

#userMenu.hidden {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    pointer-events: none;
    visibility: hidden;
}

/* Ensure dropdown is visible when not hidden */
#userMenu:not(.hidden) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

/* User avatar consistency */
.user-avatar {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Chevron rotation when dropdown is open */
#userMenuToggle[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

/* Session duration animation */
#sessionDuration {
    animation: fadeIn 0.3s ease;
}

@keyframes sessionUpdate {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Card Shadows */
.card-shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.card-shadow:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Dashboard Widget Animations */
.dashboard-widget {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Sparkline Container */
.sparkline-container {
    width: 64px;
    height: 32px;
}

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: var(--radius-small);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.approved {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.rejected {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge.submitted {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.status-badge.completed {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Form Styles */
.form-input {
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: white;
    color: var(--neutral-700);
    border: 1px solid var(--neutral-300);
}

.btn-secondary:hover {
    background-color: var(--neutral-100);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

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

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

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: var(--neutral-100);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--neutral-700);
    border-bottom: 1px solid var(--neutral-200);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--neutral-200);
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Logout Modal Specific Styles */
.modal-overlay.opacity-0 {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Loading Spinner */
.spinner {
    border: 2px solid var(--neutral-200);
    border-top: 2px solid var(--brand-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background-color: var(--success);
    color: white;
}

.notification.error {
    background-color: var(--danger);
    color: white;
}

.notification.warning {
    background-color: var(--warning);
    color: white;
}

.notification.info {
    background-color: var(--info);
    color: white;
}

/* Sidebar Mobile Styles */
@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
        position: fixed;
        height: 100vh;
        z-index: 50;
        transition: transform 0.3s ease;
        width: 280px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    /* Ensure main content adjusts on mobile */
    main {
        width: 100%;
    }
}

/* Desktop sidebar styles */
@media (min-width: 1024px) {
    #sidebar {
        position: relative;
        transform: translateX(0);
        transition: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-page .grid {
        grid-template-columns: 1fr;
    }

    /* Adjust sidebar width on smaller screens */
    #sidebar {
        width: 260px;
    }
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

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

/* Chart Container */
.chart-container {
    height: 300px;
    width: 100%;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    .print-full-width {
        width: 100% !important;
    }
}