/* ==============================
   Base & Reset
   ============================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* Scrollbar (optional, subtle) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}
::-webkit-scrollbar-track {
    background: #e5e7eb;
}

/* ==============================
   Layout
   ============================== */

.page {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 64px - 56px); /* header + footer approx */
}

/* Page title */
.page-title {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: #111827;
}

/* ==============================
   Header / Topbar
   ============================== */

.topbar {
    background: linear-gradient(90deg, #111827, #1f2937);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Brand */

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: radial-gradient(circle at 30% 30%, #60a5fa, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: #e5f2ff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.6);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 600;
    font-size: 1rem;
}

.brand-subtitle {
    font-size: 0.75rem;
    opacity: 0.75;
}

/* ==============================
   Navigation
   ============================== */

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.nav-links a {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nav-links a:hover {
    background: rgba(31, 41, 55, 0.9);
    color: #fff;
    transform: translateY(-1px);
}

/* User chip */

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(148, 163, 184, 0.5);
}

.user-initials {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    margin-top: 0.05rem;
}

.user-logout {
    font-size: 0.75rem;
    color: #93c5fd;
    text-decoration: none;
    margin-top: 0.15rem;
}

.user-logout:hover {
    text-decoration: underline;
}

/* Mobile toggle */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(148, 163, 184, 0.7);
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 1.1rem;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
}

/* ==============================
   Footer
   ============================== */

.footer {
    background: #0f172a;
    color: #e5e7eb;
    margin-top: 2rem;
    border-top: 1px solid #111827;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.footer-muted {
    opacity: 0.7;
    margin-left: 0.25rem;
}

.footer-tagline {
    opacity: 0.8;
    font-size: 0.78rem;
}

/* ==============================
   Cards & Containers
   ============================== */

.card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    margin-bottom: 1rem;
}

.card h2, .card h3 {
    margin-bottom: 0.5rem;
    color: #111827;
}

/* Dashboard grid */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

/* ==============================
   Badges / Pills
   ============================== */

.badge {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #e5e7eb;
    color: #374151;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-red {
    background: #fee2e2;
    color: #b91c1c;
}

/* ==============================
   Forms & Inputs
   ============================== */

label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    background: #f9fafb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
    background: #ffffff;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */

button,
input[type="submit"] {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

button:hover,
input[type="submit"]:hover {
    background: #1e40af;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.2);
    transform: translateY(-1px);
}

button:active,
input[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}

/* Links styled like buttons (e.g. "Reset") */
a.button-link {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.85rem;
    text-decoration: none;
}

a.button-link:hover {
    background: #d1d5db;
}

/* ==============================
   Tables
   ============================== */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    min-width: 600px;
}

.table th, .table td {
    border: 1px solid #e5e7eb;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.table tr:nth-child(even) td {
    background: #f9fafb;
}

/* Actions inside table */
.table td form {
    display: inline;
}

/* ==============================
   Tabs (for project details)
   ============================== */

.tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.tab-button {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    color: #6b7280;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tab-button:hover {
    color: #111827;
    background: #f9fafb;
}

.tab-button.active {
    border-color: #1d4ed8;
    color: #111827;
    font-weight: 600;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ==============================
   Filter row (reports)
   ============================== */

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.filter-row > div {
    flex: 1 1 140px;
}

/* ==============================
   Icons / Misc
   ============================== */

a {
    color: #2563eb;
}

a:hover {
    color: #1d4ed8;
}

/* ==============================
   Responsive
   ============================== */

@media (max-width: 768px) {
    .topbar-inner {
        padding: 0.6rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .mobile-menu-toggle {
        display: block;
        align-self: flex-end;
    }

    .main-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-top: 0.25rem;
        display: none;
        width: 100%;
    }

    .main-nav.open {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
    }

    .nav-links a {
        width: 100%;
        padding: 0.4rem 0.55rem;
    }

    .user-chip {
        width: 100%;
        justify-content: flex-start;
        border-left: none;
        border-top: 1px solid rgba(148, 163, 184, 0.4);
        padding-top: 0.5rem;
        margin-top: 0.35rem;
    }

    .page {
        padding: 1rem;
    }

    .table {
        min-width: 500px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .table {
        min-width: 420px;
    }
}
/* ==============================
   Auth / Login Page Styling
   ============================== */

.auth-container {
    position: relative;
    min-height: calc(100vh - 120px); /* header + footer approx */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* Gradient background behind the login card */
.auth-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.25rem;
    background:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.25), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(244, 114, 182, 0.18), transparent 55%),
        linear-gradient(135deg, #0f172a 0%, #1f2937 40%, #1d4ed8 100%);
    opacity: 0.95;
    z-index: 0;
}

/* If you want a construction photo behind everything, uncomment and set your image:
.auth-container::before {
    background:
        linear-gradient(135deg, rgba(15,23,42,0.9), rgba(37,99,235,0.85)),
        url('images/construction-site.jpg') center/cover no-repeat;
}
*/

.auth-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: rgba(15, 23, 42, 0.92);
    color: #e5e7eb;
    border-radius: 18px;
    padding: 1.8rem 1.6rem;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.7),
        0 0 0 1px rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(14px);
}

/* Top text inside login card */
.auth-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-header p {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* Inputs inside auth panel */
.auth-panel label {
    color: #e5e7eb;
}

.auth-panel input[type="email"],
.auth-panel input[type="password"] {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(148, 163, 184, 0.7);
    color: #e5e7eb;
}

.auth-panel input[type="email"]:focus,
.auth-panel input[type="password"]:focus {
    background: rgba(15, 23, 42, 1);
    border-color: #60a5fa;
}

/* Login button */
.auth-button {
    width: 100%;
    margin-top: 0.2rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.5);
    border: none;
}

.auth-button:hover {
    background: linear-gradient(90deg, #1d4ed8, #4338ca);
}

/* Error badge spacing */
.auth-error {
    margin-bottom: 0.75rem;
}

/* Footer text inside card */
.auth-footer-text {
    margin-top: 1rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.auth-footer-muted {
    color: #9ca3af;
}

/* Make gradient container stretch fully on mobile */
@media (max-width: 768px) {
    .auth-container {
        padding: 1.5rem 0.75rem;
        min-height: calc(100vh - 110px);
    }

    .auth-panel {
        padding: 1.4rem 1.2rem;
        border-radius: 16px;
    }
}
