/*
 * Author's Vault — Core Stylesheet
 * My Own Ghostwriter branding: Pink/Magenta + Teal accents
 * Mobile-first (78% of clients on mobile)
 */

/* ── Variables ──────────────────────────────────────── */
:root {
    --pink:        #e74c8b;
    --pink-dark:   #c73a74;
    --pink-light:  #fce4f0;
    --teal:        #00b4d8;
    --teal-dark:   #0096b4;
    --teal-light:  #e0f7fc;
    --gold:        #f4a261;
    --green:       #2ecc71;
    --green-light: #eafaf1;
    --red:         #e74c3c;
    --red-light:   #fdedec;
    --yellow:      #f39c12;
    --yellow-light:#fef9e7;
    --gray-50:     #fafafa;
    --gray-100:    #f5f5f5;
    --gray-200:    #eeeeee;
    --gray-300:    #e0e0e0;
    --gray-400:    #bdbdbd;
    --gray-500:    #9e9e9e;
    --gray-600:    #757575;
    --gray-700:    #616161;
    --gray-800:    #424242;
    --gray-900:    #212121;
    --white:       #ffffff;
    --shadow-sm:   0 1px 2px rgba(0,0,0,0.05);
    --shadow:      0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg:   0 4px 16px rgba(0,0,0,0.12);
    --radius:      8px;
    --radius-lg:   12px;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--gray-100);
    line-height: 1.6;
}

a { color: var(--pink); text-decoration: none; }
a:hover { color: var(--pink-dark); }

img { max-width: 100%; height: auto; }

/* ── SVG Icons ──────────────────────────────────────── */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    margin-right: 0.25rem;
}
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 48px; height: 48px; }
.icon-success { color: var(--green); }
.icon-danger  { color: var(--red); }
.icon-warning { color: var(--yellow); }

.nav-icon .icon { width: 18px; height: 18px; }

.empty-state .icon-xl {
    margin-bottom: 0.5rem;
    color: var(--gray-400);
}

/* ── Auth Pages ─────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--pink-light) 0%, var(--teal-light) 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 1rem; }

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    font-size: 1.5rem;
    color: var(--pink);
    margin-bottom: 0.25rem;
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.auth-form .form-group { margin-bottom: 1.25rem; }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

/* ── App Layout ─────────────────────────────────────── */
.app-wrapper { min-height: 100vh; }

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.top-bar-brand { flex: 1; }
.top-bar-brand a {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--pink);
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.user-name { color: var(--gray-700); }

/* Hamburger */
.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.5rem;
}
.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 1px;
    transition: 0.2s;
}

.app-body {
    display: flex;
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 90;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-brand {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
    padding: 0.5rem 0;
}

.sidebar-nav .nav-section {
    padding: 1rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: var(--gray-700);
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: var(--gray-50);
    color: var(--pink);
}

.sidebar-nav a.active {
    background: var(--pink-light);
    color: var(--pink);
    border-left-color: var(--pink);
    font-weight: 600;
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-user { color: var(--gray-500); }

/* ── Content Area ───────────────────────────────────── */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    max-width: 1200px;
}

/* ── Cards ──────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1rem;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2, .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-body { padding: 1.25rem; }

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stat Cards (Dashboard) ─────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card.stat-danger { border-left: 4px solid var(--red); }
.stat-card.stat-danger .stat-value { color: var(--red); }
.stat-card.stat-success { border-left: 4px solid var(--green); }
.stat-card.stat-warning { border-left: 4px solid var(--yellow); }
.stat-card.stat-info { border-left: 4px solid var(--teal); }

/* ── Page Headers ───────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.page-header .subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ── Tables ─────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
    vertical-align: middle;
}

tbody tr:hover { background: var(--gray-50); }

.table-actions { white-space: nowrap; }
.table-actions a { margin-right: 0.5rem; }

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(231, 76, 139, 0.15);
}

textarea { min-height: 100px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-help {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--pink);
    color: var(--white);
}
.btn-primary:hover { background: var(--pink-dark); color: var(--white); }

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }

.btn-teal {
    background: var(--teal);
    color: var(--white);
}
.btn-teal:hover { background: var(--teal-dark); color: var(--white); }

.btn-outline {
    background: transparent;
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-50); }

.btn-danger {
    background: var(--red);
    color: var(--white);
}
.btn-danger:hover { background: #c0392b; color: var(--white); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-block { display: flex; justify-content: center; width: 100%; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary   { background: var(--pink-light); color: var(--pink); }
.badge-success   { background: var(--green-light); color: #1a9c55; }
.badge-warning   { background: var(--yellow-light); color: #b37d00; }
.badge-danger    { background: var(--red-light); color: var(--red); }
.badge-info      { background: var(--teal-light); color: var(--teal-dark); }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }
.badge-admin     { background: var(--pink-light); color: var(--pink); }
.badge-client    { background: var(--teal-light); color: var(--teal); }

/* ── Alerts ─────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.alert-success { background: var(--green-light); border-color: var(--green); color: #1a6b38; }
.alert-danger  { background: var(--red-light); border-color: var(--red); color: #922b21; }
.alert-warning { background: var(--yellow-light); border-color: var(--yellow); color: #7d5a00; }
.alert-info    { background: var(--teal-light); border-color: var(--teal); color: #0077a3; }

/* ── Empty States ───────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-state h3 { color: var(--gray-600); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9rem; margin-bottom: 1rem; }

/* ── Step Indicator ─────────────────────────────────── */
.step-indicator {
    display: flex;
    gap: 0;
    margin: 1rem 0;
    overflow-x: auto;
}

.step-indicator .step {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    position: relative;
    min-width: 100px;
}

.step-indicator .step::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -1px;
    width: 2px;
    height: 60%;
    background: var(--gray-300);
    transform: translateY(-50%);
}

.step-indicator .step:last-child::after { display: none; }

.step-indicator .step.completed { background: var(--green-light); color: #1a9c55; }
.step-indicator .step.active    { background: var(--pink-light); color: var(--pink); border-bottom: 3px solid var(--pink); }
.step-indicator .step.upcoming  { background: var(--gray-100); color: var(--gray-500); }
.step-indicator .step.overdue   { background: var(--red-light); color: var(--red); }

.step-indicator .step-number { display: block; font-size: 1.25rem; }
.step-indicator .step-title  { display: block; margin-top: 0.25rem; }

/* ── Utility ────────────────────────────────────────── */
.text-muted  { color: var(--gray-500); }
.text-small  { font-size: 0.8rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ── Mobile Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    
    .content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .top-bar-user .user-name { display: none; }
    .top-bar-user .user-role { display: none; }
    
    .page-header { flex-direction: column; align-items: flex-start; }
    
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    
    .form-row { grid-template-columns: 1fr; }
    
    .step-indicator { overflow-x: auto; }
    .step-indicator .step { min-width: 80px; }
    
    table { font-size: 0.85rem; }
    thead th, tbody td { padding: 0.5rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 1.5rem 1.25rem; }
}

/* ── Styled File Inputs ─────────────────────────────── */
/* Hide the native file input, show a custom button */
.file-upload-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.file-upload-wrap input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-btn,
.form-group .file-upload-btn,
label.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    background: var(--teal) !important;
    color: #ffffff !important;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.file-upload-btn:hover {
    background: var(--teal-dark);
    transform: translateY(-1px);
}
.file-upload-btn:active {
    transform: translateY(0);
}
.file-upload-btn .upload-icon {
    font-size: 1rem;
    line-height: 1;
}

.file-upload-name {
    font-size: 0.8rem;
    color: var(--gray-600);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Submit button after file selection */
.btn-upload-submit,
.form-group .btn-upload-submit,
button.btn-upload-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    background: var(--pink) !important;
    color: #ffffff !important;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s;
}
.btn-upload-submit:hover {
    background: var(--pink-dark);
}
.btn-upload-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Uploaded file display */
.uploaded-file {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    background: var(--green-light);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}
.uploaded-file a {
    color: var(--gray-800);
    font-weight: 500;
}

/* Contract Type Cards */
.contract-type-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.contract-type-card {
    display: block;
    background: var(--bg-card, #fff);
    border: 2px solid var(--border, #e5e7eb);
    border-radius: 10px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.contract-type-card:hover {
    border-color: var(--primary, #f44b94);
    box-shadow: 0 4px 12px rgba(244, 75, 148, 0.1);
}
.contract-type-card.selected {
    border-color: var(--primary, #f44b94);
    background: rgba(244, 75, 148, 0.03);
    box-shadow: 0 4px 16px rgba(244, 75, 148, 0.15);
}
.contract-type-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.ctc-inner { }
.ctc-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text, #1a1a2e);
    margin-bottom: 0.25rem;
}
.ctc-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text, #1a1a2e);
    margin-bottom: 0.25rem;
}
.ctc-details {
    font-size: 0.8rem;
    color: var(--muted, #9ca3af);
    line-height: 1.4;
}