/* DFMClone — Construction Document Management */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8e;
    --primary-dark: #0f2440;
    --accent: #16a34a;
    --amber: #f59e0b;
    --red: #dc2626;
    --grey-50: #f9fafb;
    --grey-100: #f3f4f6;
    --grey-200: #e5e7eb;
    --grey-300: #d1d5db;
    --grey-400: #9ca3af;
    --grey-500: #6b7280;
    --grey-600: #4b5563;
    --grey-700: #374151;
    --grey-800: #1f2937;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--grey-800);
    background: var(--grey-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Navbar ── */
.navbar {
    background: var(--primary-dark);
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container { display: flex; align-items: center; justify-content: space-between; }

.nav-logo {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.nav-logo:hover { text-decoration: none; color: #fff; }
.logo-icon { font-size: 1.3rem; }

.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: rgba(255,255,255,.8); font-size: .9rem; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links .nav-danger { color: #fca5a5; }
.nav-links .nav-danger:hover { color: #fecaca; }
.nav-user { color: rgba(255,255,255,.7); font-size: .9rem; }

/* ── Footer ── */
.footer {
    background: var(--grey-800);
    color: var(--grey-400);
    padding: 1.5rem 0;
    font-size: .85rem;
    text-align: center;
    margin-top: 3rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius);
    background: #fff;
    color: var(--grey-700);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { background: var(--grey-100); text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }

.btn-success { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-outline-dark { border-color: var(--grey-400); color: var(--grey-700); }
.btn-outline-dark:hover { background: var(--grey-200); }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    padding: 5rem 0;
    text-align: center;
}
.hero h1 { font-size: 2.8rem; font-weight: 800; line-height: 1.2; margin-bottom: 1rem; }
.hero-sub { font-size: 1.15rem; color: rgba(255,255,255,.8); max-width: 580px; margin: 0 auto 2rem; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; }

/* ── Features ── */
.features { padding: 4rem 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2rem; }
.feature-card {
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}
.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: .5rem; font-size: 1.1rem; }
.feature-card p { color: var(--grey-500); font-size: .9rem; }

/* ── Page Layout ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.75rem; margin-bottom: .25rem; }

.header-actions { display: flex; gap: .75rem; align-items: center; }

.admin-content, .portal-content, .client-content { padding-top: 2rem; }

.breadcrumb { font-size: .9rem; color: var(--grey-500); margin-bottom: .25rem; }
.breadcrumb a { color: var(--primary-light); }

.text-muted { color: var(--grey-500); }

/* ── Progress Bars ── */
.overall-progress { margin-bottom: 2rem; }
.overall-stats { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .5rem; }
.big-pct { font-size: 2rem; font-weight: 700; }

.progress-bar {
    background: var(--grey-200);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}
.progress-bar-lg { height: 12px; }
.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .3s ease;
}

/* ── Data Tables ── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}
.data-table th {
    background: var(--grey-100);
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--grey-500);
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--grey-200);
}
.data-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--grey-100);
    font-size: .9rem;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }

.action-buttons { display: flex; gap: .4rem; }

/* ── Status Badges ── */
.status-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}
.badge-grey { background: var(--grey-400); }
.badge-red { background: var(--red); color: #fff; font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; }
.badge-amber { background: var(--amber); color: #fff; font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; }

.pct-badge {
    display: inline-block;
    padding: .3rem .75rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
}

/* ── Two Column Layout ── */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; }
.col-main { min-width: 0; }

/* ── Side Cards ── */
.side-card {
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.side-card h3 { font-size: 1rem; margin-bottom: .75rem; color: var(--grey-700); }

.sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--grey-100);
}
.sub-row:last-child { border-bottom: none; }

.copy-input {
    width: 100%;
    padding: .5rem;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    font-size: .8rem;
    background: var(--grey-50);
    color: var(--grey-600);
    margin-bottom: .25rem;
}

.activity-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: .4rem 0;
    border-bottom: 1px solid var(--grey-100);
    font-size: .85rem;
    gap: .5rem;
}
.activity-row:last-child { border-bottom: none; }
.activity-detail { flex: 1; }
.activity-time { white-space: nowrap; font-size: .8rem; }

/* ── Project Grid (Dashboard) ── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }

.project-card {
    display: block;
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: box-shadow .15s, border-color .15s;
    color: inherit;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--grey-300); text-decoration: none; }

.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.project-card-header h3 { font-size: 1.1rem; }

.project-meta {
    display: flex;
    gap: 1rem;
    font-size: .8rem;
    color: var(--grey-500);
    margin-top: .75rem;
}

/* ── Forms ── */
.form-page { padding: 3rem 0; }
.form-page h1 { margin-bottom: .5rem; }
.form-intro { color: var(--grey-500); margin-bottom: 2rem; }

.dfm-form .form-group { margin-bottom: 1.25rem; }
.dfm-form label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; color: var(--grey-700); }

.dfm-form input[type="text"],
.dfm-form input[type="email"],
.dfm-form input[type="tel"],
.dfm-form input[type="date"],
.dfm-form input[type="password"],
.dfm-form select,
.dfm-form textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    transition: border-color .15s;
}
.dfm-form input:focus, .dfm-form select:focus, .dfm-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; margin-top: .35rem; }
.checkbox-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    padding: .4rem .5rem;
    background: var(--grey-50);
    border-radius: var(--radius);
    cursor: pointer;
}
.checkbox-item:hover { background: var(--grey-100); }

.inline-form { display: flex; gap: .5rem; }
.inline-form input[type="text"] {
    flex: 1;
    padding: .5rem .75rem;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius);
    font-size: .9rem;
}

/* ── Login ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 130px);
}
.login-box {
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.login-box h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.login-error { background: #fef2f2; color: var(--red); padding: .75rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; text-align: center; }

/* ── Portal (Sub) ── */
.portal-section { margin-bottom: 2rem; }
.portal-section h2 { font-size: 1.2rem; margin-bottom: .75rem; color: var(--primary); }

.upload-btn { cursor: pointer; }

.rejection-note {
    margin-top: .3rem;
    color: var(--red);
    font-size: .8rem;
    font-style: italic;
}

/* ── Client View ── */
.client-section { margin-bottom: 2rem; }
.client-section h2 { font-size: 1.2rem; margin-bottom: .75rem; color: var(--primary); }

/* ── Add Item Form ── */
.add-item-form { border-top: 1px solid var(--grey-200); padding-top: 1rem; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--grey-500);
    font-size: 1.05rem;
}
.empty-state a { color: var(--primary-light); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
    .page-header { flex-direction: column; }
    .project-grid { grid-template-columns: 1fr; }
    .data-table { font-size: .85rem; }
    .data-table th, .data-table td { padding: .5rem .65rem; }
}
