/**
 * RundownHQ Layout System
 * Sidebar navigation with responsive design
 */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* App Layout Structure */
.app {
    display: flex;
    min-height: 100vh;
    background-color: #f5f7fa;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px; /* Space for sidebar */
    transition: margin-left 0.3s ease;
}

/* Adjust margin when sidebar is collapsed */
.sidebar.collapsed ~ .main-content {
    margin-left: 64px;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #2c3e50;
    color: white;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
    border-right: 1px solid #34495e;
}

.sidebar.collapsed {
    width: 64px;
}





.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.password-requirements {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    margin-top: 16px;
    border-left: 4px solid #007bff;
}

.password-requirements p {
    margin: 0 0 8px 0;
    font-weight: 500;
    color: #495057;
}

.password-requirements ul {
    margin: 0;
    padding-left: 20px;
    color: #6c757d;
}

.password-requirements li {
    font-size: 13px;
    margin-bottom: 4px;
}

.profile-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.profile-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.profile-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.profile-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Sidebar Header */
.sidebar-header {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #34495e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.sidebar.collapsed .sidebar-logo:hover {
    background: rgba(255, 255, 255, 0.08);
}

.logo-image {
    height: 28px;
    width: auto;
    max-width: 180px;
    transition: all 0.3s ease;
}

.sidebar.collapsed .logo-image {
    height: 22px;
    max-width: 36px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem 0.375rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-toggle {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

/* Navigation Sections */
.sidebar-nav {
    padding: 0.5rem 0;
}

.nav-section {
    margin-bottom: 0.25rem;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    color: #95a5a6;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #bdc3c7;
}

.section-icon {
    min-width: 18px;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.section-title {
    flex: 1;
}

.section-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.nav-section[open] .section-chevron {
    transform: rotate(180deg);
}

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

/* Navigation Items */
.section-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem 0.625rem 2.25rem;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: #3498db;
}

.nav-link.active {
    background: rgba(52, 152, 219, 0.15);
    color: #5dade2;
    border-left-color: #3498db;
    font-weight: 500;
}

.nav-icon {
    min-width: 18px;
    margin-right: 0.625rem;
    font-size: 0.95rem;
}

.sidebar.collapsed .nav-link {
    padding: 0.625rem 0.875rem;
    justify-content: center;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 0.875rem;
    border-top: 1px solid #34495e;
    background: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #95a5a6;
    font-size: 0.85rem;
}

.user-icon {
    font-size: 1.1rem;
}

.settings-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.25rem 0.375rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.settings-icon {
    font-size: 0.95rem;
}

.sidebar.collapsed .user-name {
    display: none;
}

.sidebar.collapsed .settings-btn {
    display: none;
}

/* Content Area Adjustments */
body:not(.sidebar-collapsed) .main-content {
    margin-left: 260px;
}

body.sidebar-collapsed .main-content {
    margin-left: 64px;
}

/* Header Adjustments */
.header {
    position: relative;
    z-index: 999;
}

/* Mobile Hamburger */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    margin: 2px 0;
    transition: 0.3s;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    body.mobile-menu-open .sidebar {
        transform: translateX(0);
    }
    
    body.mobile-menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    /* Animate hamburger */
    body.mobile-menu-open .mobile-menu-toggle span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    body.mobile-menu-open .mobile-menu-toggle span:nth-child(2) {
        opacity: 0;
    }
    
    body.mobile-menu-open .mobile-menu-toggle span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
}

/* Hide original nav links */
.nav-links {
    display: none;
}

/* Content container adjustments */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 20px;
}

/* Ensure tables and content are responsive */
.table-container {
    overflow-x: auto;
}

/* Smooth scrolling for sidebar */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: #34495e #2c3e50;
}

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

.sidebar::-webkit-scrollbar-track {
    background: #2c3e50;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #34495e;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #4a5f7a;
}

/* Focus styles for accessibility */
.nav-link:focus,
.section-header:focus,
.sidebar-toggle:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animation for section expand/collapse */
.section-items {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Ensure proper spacing */
.sidebar.collapsed .nav-section:not([open]) .section-items {
    display: none;
}

/* Profile Settings Modal Styles */
.profile-settings-modal {
    max-width: 580px;
    width: 90%;
    margin: 50px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.profile-settings-modal .modal-header {
    padding: 24px 24px 0 24px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-settings-modal .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-settings-modal .header-left h2 {
    color: #1a1a1a;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.profile-settings-modal .modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.profile-settings-modal .modal-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin: 20px 24px 0 24px;
    gap: 0;
}

.profile-tab {
    padding: 12px 0;
    margin-right: 32px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #9ca3af;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.profile-tab:hover {
    color: #6b7280;
}

.profile-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.profile-settings-modal .modal-body {
    padding: 32px 24px 24px 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.profile-photo-section {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.photo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.photo-circle {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e5e7eb;
    background: #f9fafb;
}

.profile-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-circle:hover .photo-overlay {
    opacity: 1;
}

.upload-photo-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.upload-photo-btn:hover {
    background: #2563eb;
}

.upload-photo-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.photo-label {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.profile-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

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

.profile-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

/* Global form input styles */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Profile modal uses the same light input styling as the rest of the app */

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* Global button styles */
.btn-cancel {
    background: #6b7280;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #4b5563;
}

.btn-save {
    background: #10b981;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save:hover {
    background: #059669;
}

/* Profile modal specific button overrides */
.profile-settings-modal .btn-cancel {
    background: #6b7280 !important;
}

.profile-settings-modal .btn-save {
    background: #10b981 !important;
}

.password-requirements {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.password-requirements p {
    margin: 0 0 0.5rem 0;
    font-weight: 500;
    color: #374151;
}

.password-requirements ul {
    margin: 0;
    padding-left: 1.2rem;
    color: #64748b;
}

.password-requirements li {
    margin-bottom: 0.25rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.profile-message {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.profile-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.profile-message.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.profile-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Modal Overlay Styles - Global for all modals */
.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: 10000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #1e293b;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.modal-body {
    padding: 2rem;
}

@media (max-width: 640px) {
    .profile-settings-modal {
        max-width: 95%;
    }
    
    .profile-form .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions button {
        width: 100%;
    }
}

/* Onboarding Navigation Badge */
.nav-badge {
    display: inline-block;
    background: #f59e0b;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.nav-badge.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.onboarding-highlight {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.onboarding-highlight .nav-link {
    color: #fbbf24;
}

.onboarding-highlight .nav-link:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

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