/* ==========================================================================
   MAMO BUILDING SERVICES - OFFICIAL 1:1 BM TRADA DIGITAL CERTIFICATE SUITE
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&family=Outfit:wght@600;700;800&display=swap');

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-panel: #f1f5f9;
    --bg-input: #ffffff;

    --border-color: #cbd5e1;
    --border-dark: #94a3b8;
    --border-focus: #0284c7;

    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);

    --success: #16a34a;
    --success-bg: #dcfce7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #d97706;
    --warning-bg: #fef3c7;

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;

    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    padding-bottom: 80px;
    line-height: 1.45;
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 28px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.login-brand-icon {
    width: 52px;
    height: 52px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.login-brand-icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
}

.modal-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    text-align: center;
}

.modal-card p.subtitle {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

.cert-type-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.cert-type-card {
    background: var(--bg-panel);
    border: 1.5px solid var(--border-color);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cert-type-card:hover, .cert-type-card.selected {
    border-color: var(--primary);
    background: #e0f2fe;
}

.cert-type-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
}

.cert-type-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Header Navbar */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon-box {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
    flex-shrink: 0;
}

.brand-icon-box svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
}

.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    line-height: 1.2;
}

.brand-text p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    background: #e0f2fe;
    color: var(--primary-hover);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.775rem;
    font-weight: 700;
    border: 1px solid #bae6fd;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    min-height: 44px;
}

.user-badge svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
}

/* Main Workspace */
.main-wrapper {
    max-width: 1200px;
    margin: 16px auto 0;
    padding: 0 16px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.metric-card label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.metric-card .value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}

.dashboard-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding-left: 38px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-dim);
    fill: none;
}

.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 2px solid var(--bg-panel);
    padding-bottom: 8px;
    text-transform: uppercase;
}

.card-title-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
    stroke-width: 2.2;
    fill: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.725rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-control {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    min-height: 46px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* OFFICIAL 1:1 WORD DOCUMENT CERTIFICATE PREVIEW SHEET */
.official-cert-sheet {
    background: #ffffff;
    border: 2px solid #000000;
    padding: 24px;
    margin: 20px 0;
    font-family: 'Inter', Arial, sans-serif;
    color: #000000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.official-cert-header {
    text-align: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.official-cert-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.official-cert-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0284c7;
    margin-top: 4px;
    text-transform: uppercase;
}

.official-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.official-table th, .official-table td {
    border: 1px solid #000000;
    padding: 8px 12px;
    font-size: 0.875rem;
    vertical-align: top;
}

.official-table th {
    background: #f1f5f9;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
}

.official-field-box {
    background: #ffffff;
    border: 1px solid #000000;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.official-field-box label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
    color: #334155;
}

.official-field-box .val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #000000;
    min-height: 22px;
}

/* Status Buttons */
.status-pill-group {
    display: flex;
    gap: 6px;
    background: var(--bg-panel);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.status-pill {
    flex: 1;
    padding: 12px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: #ffffff;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
}

.status-pill.active[data-status="yes"] { background: var(--success); color: #ffffff; }
.status-pill.active[data-status="no"] { background: var(--danger); color: #ffffff; }
.status-pill.active[data-status="na"] { background: var(--text-muted); color: #ffffff; }

/* Signature Pad */
.signature-box {
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-top: 6px;
}

canvas {
    width: 100%;
    height: 120px;
    background: #ffffff;
    cursor: crosshair;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
}

/* Logs List */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-ref {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.log-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.log-badge.pass { background: var(--success-bg); color: var(--success); }
.log-badge.fail { background: var(--danger-bg); color: var(--danger); }

/* PRINT STYLES - PERFECT 1:1 PRINTABLE OFFICIAL FORM */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
    }
    .app-header, .dashboard-bar, .metrics-grid, .signature-actions, .quick-fill-bar, .btn, .modal-overlay {
        display: none !important;
    }
    .main-wrapper {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .official-cert-sheet {
        border: 2px solid #000000 !important;
        padding: 15px !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    .official-table th, .official-table td, .official-field-box {
        border: 1px solid #000000 !important;
    }
}
