/* ===============================
   GLOBAL
=============================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: #f5f6fa;
    color: #212529;
    display: flex;
    flex-direction: column;
    align-items: center;

    /* ✅ Safari fix: 100vh can be wrong; keep fallback + modern unit */
    min-height: 100vh;
    min-height: 100dvh;

    /* ✅ Better font rendering on macOS */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* ✅ Prevent horizontal scroll from rounding/layout quirks */
    overflow-x: hidden;

    /* ✅ Safe area padding for iOS/macOS Safari (harmless elsewhere) */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Make tappable/clickable elements more responsive */
a,
button {
    cursor: pointer;
    touch-action: manipulation;
}

/* ===============================
   HEADER
=============================== */
.header {
    width: 100%;
    background-color: #0b3d91; /* гос-синий */
    border-bottom: 3px solid #07285c;
    padding: 14px 16px;

    /* ✅ Safe area top for Safari (iOS, but ok everywhere) */
    padding-top: calc(14px + env(safe-area-inset-top));
}

.header-container {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: contain;
}

.header-text h1 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

/* ===============================
   MAIN CARD (about.html)
=============================== */
.content {
    background-color: #ffffff;
    width: 100%;
    max-width: 480px;
    margin: 32px auto;
    padding: 24px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.verification-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

label {
    font-size: 14px;
    font-weight: 500;
    color: #212529;
}

/* ✅ Safari/macOS form normalization */
input,
button,
select,
textarea {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 14px;
    outline: none;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;

    /* ✅ Avoid iOS zoom on focus (keeps >=16px only if you want; but we keep 14 for design)
       If you ever see zoom on iPhone, bump font-size to 16px for mobile via media query */
}

input:focus {
    border-color: #0b3d91;
    box-shadow: 0 0 0 2px rgba(11, 61, 145, 0.15);
}

/* ===============================
   BUTTONS
=============================== */
.btn {
    display: inline-block;
    text-align: center;
    padding: 10px 14px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease,
        color 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus {
    outline: none;
}

/* ✅ Keyboard focus visible (better accessibility, also stable on Safari) */
.btn:focus-visible,
.back-btn:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid rgba(11, 61, 145, 0.35);
    outline-offset: 2px;
}

.btn-main {
    background-color: #0b3d91;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.btn-main:hover {
    background-color: #07285c;
}

.btn-secondary {
    background-color: #e9ecef;
    color: #212529;
    box-shadow: none;
    border: 1px solid #ced4da;
}

.btn-secondary:hover {
    background-color: #dde1e5;
    border-color: #b5bcc5;
}

.samples-link {
    font-size: 13px;
    color: #0b3d91;
    text-decoration: none;
    margin: 4px 0 10px;
}

.samples-link:hover {
    text-decoration: underline;
}

/* ===============================
   VERIFIED PAGE (index.html)
=============================== */
.verified-content {
    width: 100%;
    max-width: 720px;
    margin: 32px auto;
    display: flex;
    justify-content: center;
    padding: 0 16px;
}

.verified-box {
    background-color: #ffffff;
    width: 100%;
    padding: 24px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    border-top: 4px solid #0b3d91;

    /* ✅ Prevent long strings from breaking layout (Safari sometimes worse here) */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.verified-box h2 {
    font-size: 20px;
    font-weight: 600;
    color: #0b3d91;
    margin-bottom: 16px;
}

.verified-box p {
    font-size: 14px;
    color: #495057;
}

/* Таблица результата */
.apostille-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 20px;
    font-size: 14px;
}

.apostille-table th,
.apostille-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.apostille-table th {
    width: 40%;
    font-weight: 600;
    background-color: #f1f3f5;
    color: #212529;
}

.apostille-table td {
    color: #343a40;
}

/* Кнопка "Back to Verification" */
.back-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 14px;
    border-radius: 4px;
    border: 1px solid #0b3d91;
    color: #0b3d91;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background-color: #ffffff;
    transition: background-color 0.15s ease, color 0.15s ease,
        border-color 0.15s ease;
}

.back-btn:hover {
    background-color: #0b3d91;
    color: #ffffff;
}

/* ===============================
   ADMIN PAGE GRID (admin.html)
=============================== */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.file-card {
    background-color: #ffffff;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* ===============================
   RESPONSIVE
=============================== */
@media (max-width: 600px) {
    .header-container {
        justify-content: center;
        text-align: center;
    }

    .content {
        margin: 20px 12px;
        padding: 20px 16px;
    }

    .verified-content {
        margin: 20px 12px;
    }

    /* ✅ If you ever see iPhone Safari zooming input on focus, uncomment:
    input { font-size: 16px; }
    */
}
