/* ==========================================================================
   AI CV Matcher - Main Stylesheet
   ========================================================================== */

/* CSS Variables */
:root {
    --primary: #0ea5e9;
    --primary-light: #38bdf8;
    --primary-dark: #0284c7;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.navbar-brand {
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    font-size: 1.25rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
    font-weight: 600;
}

.user-info strong {
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Sidebar (for admin) */
.sidebar {
    width: 280px;
    background: white;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.step-card {
    background: var(--card-bg);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.step-icon {
    color: var(--primary);
    font-size: 1.5rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    padding: 0.875rem 1.75rem;
    border-radius: 0.75rem;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.3);
}

.btn-outline {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.btn-analyze {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: 0.2s;
}

.btn-analyze:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.tab {
    padding: 0.5rem 0;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
}

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

.tab-content {
    display: block;
}

/* AI Action Button */
.btn-ai-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ai-action:hover {
    background: rgba(14, 165, 233, 0.1);
}

/* Criteria */
.criteria-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0.75rem;
    align-items: center;
}

.weight-input {
    width: 80px;
    text-align: center;
}

.delete-btn {
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1.25rem;
}

.delete-btn:hover {
    color: var(--error);
}

.add-criteria {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1rem;
}

.total-percent {
    text-align: right;
    color: var(--success);
    font-weight: 700;
    margin-top: -1.5rem;
}

/* ==========================================================================
   Upload Zone
   ========================================================================== */

.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    background: #fbfcfe;
    transition: all 0.2s;
}

.upload-zone:hover,
.upload-zone.dragging {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.05);
}

/* ==========================================================================
   Results Panel
   ========================================================================== */

.results-panel {
    background: var(--card-bg);
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.results-empty-icon {
    background: #f1f5f9;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Badges & Status
   ========================================================================== */

.badge {
    padding: 0.35rem 0.875rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.badge-admin {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-user {
    background: #f1f5f9;
    color: #475569;
}

.badge-success {
    background: #ecfdf5;
    color: var(--success);
}

.status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--success);
    background: #ecfdf5;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: var(--error);
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    color: var(--success);
}

/* ==========================================================================
   Tables
   ========================================================================== */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-top: 1rem;
}

th,
td {
    text-align: left;
    padding: 1.25rem;
}

th {
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--border);
}

td {
    background: white;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

td:first-child {
    border-left: 1px solid var(--border);
    border-radius: 1rem 0 0 1rem;
}

td:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 1rem 1rem 0;
}

/* ==========================================================================
   Content Box
   ========================================================================== */

.content-box {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    white-space: pre-wrap;
    color: var(--text);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* ==========================================================================
   CV Cards
   ========================================================================== */

.cv-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.75rem;
    border-radius: 1.25rem;
    transition: 0.2s;
}

.cv-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.cv-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    color: var(--text);
}

.cv-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1.25rem;
}

/* ==========================================================================
   Spinner / Loading
   ========================================================================== */

.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo h1 {
    color: var(--primary);
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
}

.logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.footer-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Header
   ========================================================================== */

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

.header h1 {
    color: var(--primary);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ==========================================================================
   Modal / Alert Notifications
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease-out;
}

.toast-container {
    position: relative;
    z-index: 9999;
    width: 100%;
    max-width: 450px;
    padding: 1.5rem;
}

.toast {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    animation: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.toast-warning {
    border-top: 5px solid var(--warning);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
    background: #fffbeb;
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.toast-icon svg {
    width: 32px;
    height: 32px;
}

.toast-content {
    width: 100%;
}

.toast-title {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.toast-message {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.toast-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toast-btn:hover {
    background: var(--primary-dark);
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modal-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}