/* ── Reset & Base ────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0b1120;
    color: #e2e8f0;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Glass ───────────────────────────────────────────────────────── */
.glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-panel {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.rounded {
    border-radius: 12px;
}

/* ── Layout ──────────────────────────────────────────────────────── */
#main-con {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 100px;
}

#top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #34d399, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Search ──────────────────────────────────────────────────────── */
.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

#search-bar {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-bar:focus {
    outline: none;
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

#search-bar::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* ── Job Cards ───────────────────────────────────────────────────── */
.job {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    cursor: default;
}

.job:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.job-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.job-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
}

.job-stage {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 20px;
    width: fit-content;
}

.stage-underground     { background: rgba(251, 191, 36, 0.15);  color: #fbbf24; }
.stage-rough-in        { background: rgba(96, 165, 250, 0.15);  color: #60a5fa; }
.stage-rough\\ in       { background: rgba(96, 165, 250, 0.15);  color: #60a5fa; }
.stage-fixture         { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.stage-complete        { background: rgba(52, 211, 153, 0.15);  color: #34d399; }

.job-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.btn-primary:hover {
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-icon-only {
    padding: 6px 8px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 12px;
    font-size: 0.9rem;
}

/* ── FAB (Floating Add Button) ───────────────────────────────────── */
#popup {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #34d399;
    font-size: 1.6rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 50;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

#popup:hover {
    transform: scale(1.08);
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.5);
    box-shadow: 0 6px 32px rgba(52, 211, 153, 0.2);
}

#popup:active {
    transform: scale(0.94);
}

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    padding: 16px;
}

.modal-overlay.modal-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 28px;
    transform: translateY(12px);
    transition: transform 0.2s;
}

.modal-overlay.modal-visible .modal {
    transform: translateY(0);
}

.modal h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #f1f5f9;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-body label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.15s;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.modal-body select {
    cursor: pointer;
}

.modal-body select option {
    background: #1e293b;
    color: #e2e8f0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    flex-wrap: wrap;
}

#modal-delete-btn {
    margin-right: auto;
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: #065f46;
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

.toast-error {
    background: #7f1d1d;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ── Empty State ─────────────────────────────────────────────────── */
#empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 0.95rem;
}

#empty-state strong {
    color: #34d399;
}

/* ── Misc ────────────────────────────────────────────────────────── */
.muted {
    color: #64748b;
    font-style: italic;
    font-size: 0.85rem;
}

hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 10px 0;
}

a {
    color: #34d399;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-wrapper {
        max-width: 100%;
        width: 100%;
    }

    .job {
        grid-template-columns: 1fr;
    }

    .job-actions {
        justify-content: flex-start;
    }

    #popup {
        width: 48px;
        height: 48px;
        bottom: 20px;
        right: 20px;
        font-size: 1.4rem;
    }

    .modal {
        padding: 20px;
        border-radius: 12px;
    }

    .modal-actions {
        flex-direction: column;
    }

    #modal-delete-btn {
        margin-right: 0;
        order: 3;
    }
}
