@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary: #00BCD4;
    --primary-hover: #00ACC1;
    --dark: #1a2332;
    --dark-light: #2c3e50;
    --light: #f8f9fa;
    --white: #FFFFFF;
    --gray: #64748b;
    --gray-light: #cbd5e1;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: flex;
}

/* Login Screen */
#login-screen {
    width: 100vw;
    height: 100vh;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

#login-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.login-container {
    background: var(--white);
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    width: 440px;
    max-width: 90%;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header img {
    height: 50px;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    font-size: 1.8rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.login-header p {
    color: var(--gray);
    font-size: 1rem;
    font-weight: 400;
}

/* Dashboard Layout */
#dashboard-screen {
    width: 100vw;
    height: 100vh;
    background: var(--light);
}

.sidebar {
    width: 280px;
    background: #1e293b;
    color: var(--white);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    position: relative;
    z-index: 100;
}

.sidebar-header {
    padding: 2.5rem 1.5rem 2rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.sidebar-header img {
    height: 36px;
    margin-bottom: 2rem;
    max-width: 180px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.06));
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.territory-badge {
    display: inline-block;
    background: linear-gradient(135deg, #00BCD4 0%, #0097a7 100%);
    color: var(--white);
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,188,212,0.2);
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
    padding: 1.5rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(0,188,212,0.08);
    color: var(--primary);
}

.nav-link:hover::before,
.nav-link.active::before {
    height: 32px;
}

.nav-link.active {
    background: rgba(0,188,212,0.12);
    color: var(--primary);
    font-weight: 600;
}

#logout-btn {
    margin: 1rem 1.5rem 2rem;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    background: var(--light);
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

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

h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--gray);
    margin-bottom: 2.5rem;
    font-size: 1rem;
    font-weight: 400;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: inherit;
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,188,212,0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #0097a7 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0,188,212,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,188,212,0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
}

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

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

.btn-danger:hover {
    background: #dc2626;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.dashboard-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.dashboard-card h3 {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #0097a7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-card p {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Training Modules */
.training-modules {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.training-module {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
}

.training-module:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.training-module h3 {
    color: var(--dark);
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
}

.training-module p {
    color: var(--gray);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.module-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Announcements */
.recent-announcements {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

.recent-announcements h2 {
    margin-bottom: 1.5rem;
    color: var(--dark);
    font-size: 1.5rem;
    font-weight: 700;
}

.announcement-item {
    border-bottom: 1px solid var(--gray-light);
    padding: 1.75rem 0;
    transition: var(--transition);
}

.announcement-item:hover {
    padding-left: 1rem;
    background: rgba(0,188,212,0.02);
    margin: 0 -1rem;
    padding-right: 1rem;
}

.announcement-item:last-child {
    border-bottom: none;
}

.announcement-item h3 {
    color: var(--dark);
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.announcement-meta {
    color: var(--gray);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Pilots Database */
.pilots-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pilots-header input,
.pilots-header select {
    padding: 0.9rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--white);
}

.pilots-header input {
    flex-grow: 1;
    min-width: 250px;
}

.pilots-header input:focus,
.pilots-header select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,188,212,0.1);
}

.pilot-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: start;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
}

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

.pilot-info h3 {
    color: var(--dark);
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 1.15rem;
}

.pilot-info p {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.pilot-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.pilot-badge.hired {
    background: rgba(59,130,246,0.1);
    color: #3b82f6;
}

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

.pilot-badge.interviewing {
    background: rgba(139,92,246,0.1);
    color: #8b5cf6;
}

.pilot-actions {
    display: flex;
    gap: 0.75rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    width: 540px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.4s ease-out;
}

.modal-content h2 {
    margin-bottom: 2rem;
    color: var(--dark);
    font-weight: 700;
    font-size: 1.6rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Tables */
table {
    width: 100%;
    margin-top: 1.5rem;
    background: var(--white);
    padding: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

thead tr {
    background: var(--light);
}

th {
    text-align: left;
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    color: var(--dark);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

td {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--gray-light);
    color: var(--gray);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(0,188,212,0.02);
}

/* Error Messages */
.error-message {
    color: var(--danger);
    margin-top: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    background: rgba(239,68,68,0.1);
    border-radius: 8px;
}

/* Success Messages */
.success-message {
    color: var(--success);
    margin-top: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    background: rgba(16,185,129,0.1);
    border-radius: 8px;
}

/* Admin Only */
.admin-only {
    display: none;
}

body.is-admin .admin-only {
    display: block;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,188,212,0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    #dashboard-screen {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .sidebar-header {
        padding: 1rem 1.5rem;
        margin: 0;
        border-bottom: none;
        border-right: 1px solid #e2e8f0;
        flex-shrink: 0;
    }
    
    .sidebar-header img {
        height: 32px;
        margin-bottom: 0;
    }
    
    .sidebar-header p {
        display: none;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
        flex-grow: 1;
        display: flex;
        white-space: nowrap;
    }
    
    .nav-link {
        padding: 1rem 1.25rem;
        font-size: 0.85rem;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .nav-link.active {
        background: rgba(0,188,212,0.08);
        border-bottom-color: var(--primary);
    }
    
    .nav-link::before {
        display: none;
    }
    
    #logout-btn {
        margin: 0 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .main-content {
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-card {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .login-container {
        padding: 2rem 1.5rem;
    }
    
    .pilot-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .pilot-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .pilot-actions button {
        width: 100%;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    
    .training-module {
        padding: 1.25rem;
    }
    
    .module-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .module-actions button,
    .module-actions .checkbox-label {
        width: 100%;
    }
    
    .pilots-header {
        flex-direction: column;
    }
    
    .pilots-header input,
    .pilots-header select,
    .pilots-header button {
        width: 100%;
    }
    
    .resource-file {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .file-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .file-actions button {
        width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 5px;
}

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

/* Resource Library Styles */
.resources-container {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.resource-folder {
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
}

.resource-folder h3 {
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.resource-folder.collapsed .folder-contents {
    display: none;
}

.resource-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.resource-file:hover {
    background: rgba(0,188,212,0.05);
    transform: translateX(4px);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
}

.file-size {
    color: var(--gray);
    font-size: 0.85rem;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

.resource-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
