@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@300;400;500;600;700&display=swap');

/* === Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Mulish', sans-serif;
    color: #1a1a1a;
    line-height: 1.6;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 16px;
}
a { color: #0057b8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Layout === */
.container { max-width: 860px; margin: 0 auto; }

/* === Headings === */
h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111;
    border-bottom: 2px solid #FBE452;
    padding-bottom: 8px;
    margin-bottom: 16px;
}
h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111;
    border-left: 4px solid #FBE452;
    padding-left: 10px;
    margin: 0 0 12px;
}
h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0057b8;
}

/* === Cards === */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 20px;
    margin-bottom: 16px;
}

/* === Home page cards === */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card-link {
    background: #fff;
    border-radius: 8px;
    padding: 28px 20px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-top: 4px solid #FBE452;
}
.card-link:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); text-decoration: none; }
.card-icon { font-size: 2.2rem; margin-bottom: 10px; }
.card-title { font-size: 1rem; font-weight: 600; color: #111; margin-bottom: 8px; }
.card-desc { color: #555; font-size: 0.85rem; line-height: 1.5; }

/* === Tables === */
.fields-table, .match-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.fields-table th, .match-table th {
    background-color: #111;
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
}
.fields-table td, .match-table td {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    font-size: 13px;
    word-break: break-word;
}
.fields-table tr:nth-child(even) td, .match-table tr:nth-child(even) td { background-color: #f5f7fa; }
.fields-table tr:nth-child(odd) td, .match-table tr:nth-child(odd) td { background-color: #fff; }
.match-table tr:hover td { background-color: #fffdf0; }

/* === Meta grid === */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.meta-item { background: #f5f7fa; border-radius: 8px; padding: 14px; text-align: center; border: 1px solid #e5e5e5; }
.meta-item .label { font-size: 10px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.meta-item .value { font-size: 16px; font-weight: 600; color: #111; margin-top: 4px; word-break: break-all; }

/* === Info rows === */
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #e5e5e5; flex-wrap: wrap; gap: 4px; }
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; color: #555; font-size: 14px; }
.info-value { color: #1a1a1a; font-size: 14px; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-family: 'Mulish', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    background: #111;
    color: #fff;
}
.btn:hover { background: #333; text-decoration: none; }
.btn-primary { background: #0057b8; color: #fff; }
.btn-primary:hover { background: #004494; }
.btn-vision { background: #111; border: 2px solid #FBE452; color: #fff; }
.btn-vision:hover { background: #222; }

/* === Forms === */
.upload-form { background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-top: 16px; }
.upload-form label { font-weight: 500; color: #333; }
.upload-form input[type="file"] { margin: 12px 0; width: 100%; }
.upload-form button { width: 100%; padding: 12px; margin-top: 8px; }
.hint { color: #666; font-size: 13px; margin-top: 5px; }
.error { color: #c00; margin-top: 10px; font-weight: 500; }

/* === Styled file input === */
.file-input-wrapper { position: relative; margin: 14px 0; }
.file-input-wrapper input[type="file"] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-input-label {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    background: #f5f7fa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.file-input-label:hover { border-color: #FBE452; background: #fffdf0; }
.file-input-label .icon { font-size: 1.4rem; }
.file-input-label .text { font-size: 0.9rem; color: #555; }
.file-input-label .text strong { color: #111; }
.file-name { margin-top: 6px; font-size: 13px; color: #0057b8; font-weight: 500; }

/* === Sample docs === */
.sample-docs { margin: 16px 0; }
.sample-docs-title { font-weight: 600; color: #333; font-size: 14px; margin-bottom: 8px; }
.sample-doc-option { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #f5f7fa; border: 1px solid #e5e5e5; border-radius: 6px; margin-bottom: 6px; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.sample-doc-option:hover { background: #fffdf0; border-color: #FBE452; }
.sample-doc-option input[type="radio"] { accent-color: #111; }
.sample-doc-option label { cursor: pointer; font-size: 13px; color: #333; }
.or-divider { text-align: center; color: #999; font-size: 12px; font-weight: 600; margin: 14px 0; text-transform: uppercase; }

/* === Code/OCR text === */
.ocr-text, pre {
    font-family: monospace;
    background-color: #f5f7fa;
    border-left: 3px solid #FBE452;
    padding: 14px;
    border-radius: 4px;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    word-break: break-word;
}

/* === Classification badges === */
.classification-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.classification-card.spam { border-left-color: #c00; }
.classification-title { font-size: 1rem; font-weight: 600; color: #111; margin-bottom: 6px; }
.confidence-badge { display: inline-block; padding: 3px 10px; border-radius: 4px; background: #FBE452; color: #111; font-size: 12px; font-weight: 700; margin-left: 8px; }
.explanation-box { background: #fffdf0; border-left: 4px solid #FBE452; padding: 10px 14px; margin-top: 8px; font-size: 14px; border-radius: 4px; }

/* === Confidence colors === */
.conf-high { color: #0a7c42; font-weight: 600; }
.conf-med { color: #b8860b; font-weight: 600; }
.conf-low { color: #c00; font-weight: 600; }

/* === Alert === */
.alert-warning { background: #fffdf0; color: #6b5900; border: 1px solid #FBE452; padding: 10px 14px; border-radius: 6px; margin-top: 10px; font-size: 14px; }

/* === Spinner === */
.spinner-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.4); z-index:999; align-items:center; justify-content:center; }
.spinner-overlay.active { display:flex; }
.spinner { width:48px; height:48px; border:5px solid #fff; border-top-color:#FBE452; border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* === Doc images === */
.doc-image { max-width: 100%; border-radius: 6px; border: 1px solid #e5e5e5; margin-bottom: 10px; }

/* === Row layout === */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) {
    .row { grid-template-columns: 1fr; }
    .meta-grid { grid-template-columns: 1fr 1fr; }
}

/* === Nav === */
.nav-link { color: #0057b8; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-link:hover { text-decoration: underline; }
.badge { display: inline-block; background: #FBE452; color: #111; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; vertical-align: middle; margin-left: 6px; }

/* === Breadcrumb === */
.breadcrumb { font-size: 13px; color: #888; margin-bottom: 12px; }
.breadcrumb a { color: #0057b8; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; color: #ccc; }

/* === Header/Branding === */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px 14px 60px; border-bottom: 2px solid #FBE452; margin: -16px -16px 20px -16px; background: #fff; position: relative; z-index: 10; }
.app-header .logo-link { display: flex; align-items: center; gap: 4px; text-decoration: none; }
.app-header .logo-img { height: 40px; }
.app-header .powered-by { font-size: 13px; color: #555; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.app-header .back-link { position: absolute; left: 50%; transform: translateX(-50%); font-size: 13px; color: #0057b8; font-weight: 500; text-decoration: none; }
.app-header .back-link:hover { text-decoration: underline; }
