/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--layout-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

:root {
    --layout-glass-control-bg: rgba(255, 255, 255, 0.2);
    --layout-glass-control-hover-bg: rgba(255, 255, 255, 0.24);
    --layout-liquid-glass-shadow:
        rgba(242, 242, 242, 0.8) 2px 2px 3px -3px inset,
        rgba(242, 242, 242, 0.8) -2px -2px 3px -3px inset,
        rgba(255, 255, 255, 0.8) -3px -3px 0.8px -3.5px inset,
        rgba(255, 255, 255, 0.8) 3px 3px 0.8px -3.5px inset,
        rgba(0, 0, 0, 0.1) 0 0 8px 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.checkcert-main {
    width: min(100%, 1060px);
    max-width: 1060px;
    margin: 42px auto 56px;
    padding: 0 clamp(14px, 3vw, 24px);
    overflow-x: clip;
}

.checkcert-grid {
    display: grid;
    grid-template-columns: minmax(320px, 440px) minmax(380px, 480px);
    align-items: start;
    justify-content: center;
    gap: clamp(28px, 4vw, 48px);
}

.checkcert-card {
    width: 100%;
    min-width: 0;
    padding: clamp(22px, 3vw, 30px);
    border: 0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.checkcert-input-card {
    position: relative;
    isolation: isolate;
    overflow: visible;
    padding-top: clamp(28px, 3.4vw, 40px);
    padding-bottom: clamp(24px, 3vw, 34px);
}

.checkcert-card-title {
    position: relative;
    z-index: 2;
    display: block;
    margin: 0 0 38px;
    padding: 0 0 4px;
    font-size: 40px;
    font-weight: 600;
    line-height: 1.24;
    text-align: center;
    letter-spacing: 0;
    text-wrap: balance;
    overflow: visible;
    background: linear-gradient(90deg, #0084ff 30%, #ff6600 60%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 70px rgba(255, 159, 64, 0.9);
}

.checkcert-result-panel {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
    min-width: 0;
    isolation: isolate;
}

.checkcert-result-panel.has-result {
    place-items: stretch;
}

.checkcert-empty-result {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: grid;
    place-items: center;
    width: 100%;
    color: #86868b;
    font-size: clamp(24px, 2.6vw, 30px);
    font-weight: 600;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.checkcert-result-panel.is-checking .checkcert-empty-result,
.checkcert-result-panel.has-result .checkcert-empty-result {
    opacity: 0;
}

.checkcert-result-card {
    position: relative;
    z-index: 2;
}

.checkcert-result-card.lazy-load {
    transition: var(--layout-lazy-load-transition);
    will-change: opacity, transform;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
    letter-spacing: 0;
}

.checkout-glass-input {
    position: relative;
    width: 100%;
    border-radius: 999px;
    overflow: hidden;
    transition: transform 0.24s ease;
}

.checkout-glass-input::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(247,248,250,0.72), rgba(232,234,238,0.46) 48%, rgba(220,223,229,0.34)),
        linear-gradient(180deg, rgba(255,255,255,0.16), transparent 22%);
    box-shadow:
        0 12px 24px rgba(120, 128, 140, 0.14),
        0 3px 8px rgba(120, 128, 140, 0.1),
        inset 0 -8px 14px rgba(136, 143, 155, 0.1),
        inset 0 1px 10px rgba(255,255,255,0.16);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    pointer-events: none;
    transition: background .24s ease, box-shadow .24s ease, backdrop-filter .24s ease, -webkit-backdrop-filter .24s ease, transform .24s ease;
}

.checkout-glass-input:focus-within::before,
.file-input-wrapper:hover::before {
    background:
        linear-gradient(180deg, rgba(248,249,251,0.78), rgba(236,238,242,0.58) 52%, rgba(226,229,235,0.44)),
        linear-gradient(180deg, rgba(255,255,255,0.24), transparent 24%);
    box-shadow:
        0 18px 38px rgba(120, 128, 140, 0.18),
        0 6px 14px rgba(120, 128, 140, 0.14),
        inset 0 -8px 14px rgba(136, 143, 155, 0.05),
        inset 0 1px 14px rgba(255,255,255,0.62);
    backdrop-filter: blur(22px) saturate(170%);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    transform: translateY(-1px);
}

.checkout-glass-input:hover {
    transform: translateY(-1px);
}

.form-input {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 58px;
    padding: 16px 18px;
    font-size: 17px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #1d1d1f;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-input::placeholder {
    color: rgba(29, 29, 31, 0.52);
}

.input-with-icon svg {
    position: absolute;
    z-index: 3;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 21px;
    height: 21px;
    stroke: rgba(29, 29, 31, 0.54);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.input-with-icon:focus-within svg {
    stroke: #0071e3;
}

.input-with-icon input[type="password"] {
    padding-left: 49px;
}

/* File Input */
.file-input-wrapper {
    display: block;
    min-height: 58px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    z-index: 6;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-display {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 58px;
    padding: 16px 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.file-name {
    color: rgba(29, 29, 31, 0.52);
    font-size: 17px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-input-display.has-file .file-name {
    color: #1d1d1f;
    font-weight: 400;
}

.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.file-icon svg {
    width: 21px;
    height: 21px;
    stroke: rgba(29, 29, 31, 0.54);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.file-input-wrapper:focus-within .file-icon svg,
.file-input-display.has-file .file-icon svg {
    stroke: #0071e3;
}

/* ============================================
   BUTTONS
   ============================================ */
.button-primary {
    width: 100%;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(0, 122, 255, 0.9), rgba(0, 113, 227, 0.78)),
        var(--layout-glass-control-bg);
    color: #fff;
    border: none;
    border-radius: 999px;
    box-shadow: var(--layout-liquid-glass-shadow);
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    min-height: 54px;
    line-height: 1;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.button-primary:hover:not(:disabled) {
    background:
        linear-gradient(180deg, rgba(0, 128, 255, 0.96), rgba(0, 119, 237, 0.88)),
        var(--layout-glass-control-hover-bg);
    transform: translateY(-1px);
}

.button-primary:active:not(:disabled) {
    transform: translateY(0);
}

.button-primary:disabled {
    cursor: not-allowed;
    opacity: 0.82;
    transform: none;
    box-shadow: none;
}

.button-primary.is-loading {
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 122, 255, 0.82), rgba(0, 102, 204, 0.78)),
        var(--layout-glass-control-bg);
}

.button-primary .btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes btn-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.button-primary .btn-spinner {
    animation-name: btn-spin;
}

.button-primary .btn-text {
    display: inline-block;
}

.button-primary.is-loading .btn-text {
    opacity: 0;
}

.button-primary.is-loading .btn-spinner {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   RESULT DISPLAY
   ============================================ */
.result {
    display: none;
    position: relative;
    background: #fff;
    border: 0;
    min-height: 0;
    padding-top: clamp(36px, 3vw, 44px);
}

.result-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--layout-glass-control-bg, rgba(255, 255, 255, 0.2));
    color: #6e6e73;
    box-shadow: var(--layout-liquid-glass-shadow, 0 0 8px rgba(0, 0, 0, 0.1));
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    font-size: 22px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.result-close:hover {
    background: var(--layout-glass-control-hover-bg, rgba(255, 255, 255, 0.24));
    color: #1d1d1f;
    transform: scale(1.04);
}

.result h3 {
    font-size: 20px;
    font-weight: 650;
    margin-bottom: 20px;
    letter-spacing: 0;
}

.result.success h3 {
    color: #248a3d;
}

.result.warning h3 {
    color: #f57c00;
}

.result.error h3 {
    color: #c62828;
}

/* Result Items */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 15px;
}

.result-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.result-item:first-child {
    padding-top: 0;
}

.result-label {
    font-weight: 600;
    color: #6e6e73;
    flex-shrink: 0;
    margin-right: 0;
}

.result-value {
    min-width: 0;
    text-align: right;
    color: #1d1d1f;
    font-weight: 650;
    word-break: break-word;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 650;
}

.status-valid {
    background: #34c759;
    color: white;
}

.status-revoked {
    background: #ff3b30;
    color: white;
}

.status-expired {
    background: #ff9500;
    color: white;
}

@media (prefers-reduced-motion: reduce) {
    .checkcert-result-card.lazy-load {
        transition: none;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1120px) {
    .checkcert-grid {
        grid-template-columns: minmax(300px, 400px) minmax(360px, 430px);
        gap: 28px;
    }

    .checkcert-card-title {
        font-size: 38px;
    }
}

@media (max-width: 920px) {
    .checkcert-main {
        width: 100%;
        margin: 8px auto 24px;
        padding: 0 22px;
    }

    .checkcert-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .checkcert-card {
        padding: 20px;
        border-radius: 22px;
    }

    .checkcert-input-card {
        padding-top: clamp(40px, 6vw, 52px);
        padding-bottom: clamp(28px, 5vw, 38px);
    }

    .checkcert-card-title {
        font-size: 40px;
        margin-bottom: 40px;
    }

}

@media (max-width: 600px) {
    .checkcert-main {
        padding: 0 18px;
    }

    .checkcert-card {
        padding: 16px;
        border-radius: 18px;
    }

    .checkcert-input-card {
        padding-top: 38px;
        padding-bottom: 28px;
    }

    .checkcert-card-title {
        font-size: 36px;
        margin-bottom: 34px;
    }

    .file-input-wrapper,
    .file-input-display {
        min-height: 58px;
    }

    .file-input-display {
        padding: 16px 18px;
    }

    .button-primary {
        font-size: 16px;
        margin-top: 8px;
    }

    .result-item {
        flex-direction: column;
        gap: 4px;
    }

    .result-value {
        text-align: left;
    }

    .result-close {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 360px) {
    .checkcert-card-title {
        font-size: 34px;
    }
}
