/* Docflow — base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    min-height: 100vh;
}

/* Header */
.header {
    background: #FFC107;
    border-bottom: 1px solid #F9A825;
    padding: 0.75rem 1rem;
}

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

.header__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #424242;
}

.header__user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.header__user-name {
    color: #1a1a1a;
    font-weight: 500;
}

.header__user-email {
    color: #888;
    font-size: 0.8125rem;
}

.header__logout {
    background: none;
    border: 1px solid #5D4037;
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #424242;
}

.header__logout:hover {
    background: #F9A825;
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #ffffff;
}

.login-page__btn {
    background: #FFC107;
    color: #212121;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.login-page__btn:hover {
    background: #FFB300;
}

.login-page__btn:active {
    background: #F9A825;
}

.login-page__btn:focus-visible {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .header__inner {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header__user-info {
        align-items: center;
    }

    .header__user {
        width: 100%;
        justify-content: space-between;
    }

    .main-content {
        padding: 0.75rem;
    }

    .home-screen__action {
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
    }

    .toolbar .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    line-height: 1.4;
}

.btn--primary {
    background: #FFC107;
    color: #212121;
}

.btn--primary:hover {
    background: #FFB300;
}

.btn--primary:active {
    background: #F9A825;
}

.btn--primary:focus-visible {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

.btn__icon {
    flex-shrink: 0;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.btn--outline {
    background: #ffffff;
    color: #555;
    border: 1px solid #d9d9d9;
}

.btn--outline:hover {
    color: #F9A825;
    border-color: #FFC107;
}

.btn--outline:focus-visible {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

.btn--disabled,
.btn:disabled {
    background: #ffffff;
    color: #bfbfbf;
    border: 1px solid #d9d9d9;
    cursor: not-allowed;
}

.btn--disabled:hover,
.btn:disabled:hover {
    background: #ffffff;
    color: #bfbfbf;
}

.upload-area {
    margin-top: 1rem;
}

.upload-area img,
.upload-area iframe {
    max-width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.upload-area iframe {
    width: 100%;
    height: 80vh;
}

.upload-error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
}

/* Home Screen */
.home-screen {
    padding-top: 1.5rem;
}

/* Document history list */
.doc-history__list {
    padding-bottom: 60px;
}

.doc-history {
    margin-top: 1.5rem;
}

.doc-history__row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 0.19rem;
    font-size: 0.7rem;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.doc-history__row:hover {
    border-color: #d9d9d9;
}

.doc-history__row--processing {
    background: #eff6ff;
    color: #1e40af;
}

.doc-history__row--processing:hover {
    border-color: #3b82f6;
}

.doc-history__row--done {
    background: #f0fdf4;
    color: #166534;
}

.doc-history__row--done:hover {
    border-color: #22c55e;
}

.doc-history__row--error {
    background: #fef2f2;
    color: #991b1b;
}

.doc-history__row--error:hover {
    border-color: #ef4444;
}

.doc-history__row--error .doc-history__status,
.doc-history__row--done .doc-history__status {
    font-size: 0.77rem;
}

.doc-history__id {
    font-weight: normal;
    font-family: monospace;
    text-align: center;
}

.doc-history__status {
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

@keyframes dot-pulse {
    0%, 100% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1); opacity: 1; }
}

.doc-history__status .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: dot-pulse 1.4s infinite ease-in-out;
}

.doc-history__status .dot:nth-child(2) { animation-delay: 0.2s; }
.doc-history__status .dot:nth-child(3) { animation-delay: 0.4s; }

.doc-history__time {
    font-weight: bold;
    color: inherit;
    text-align: center;
}

/* Day separator */
.doc-history__separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 8px;
    color: #6b7280;
    font-size: 13px;
}

.doc-history__separator:first-child {
    margin-top: 0;
}

.doc-history__separator::before,
.doc-history__separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* Pagination */
.doc-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f5f5f5;
    border-top: 1px solid #e2e8f0;
    z-index: 10;
}

.doc-pagination__btn {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font-size: 0.875rem;
    cursor: pointer;
}

.doc-pagination__btn:hover:not(:disabled) {
    background: #f1f5f9;
}

.doc-pagination__btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.doc-pagination__page {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font-size: 0.875rem;
    cursor: pointer;
}

.doc-pagination__page:hover:not(.doc-pagination__page--active) {
    background: #f1f5f9;
}

.doc-pagination__page--active {
    background: #FFC107;
    border-color: #FFC107;
    color: #212121;
    font-weight: 700;
    cursor: default;
}

.doc-pagination__ellipsis {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.875rem;
    user-select: none;
}

@media (max-width: 768px) {
    .doc-pagination {
        gap: 3px;
        padding: 8px 4px;
    }
    .doc-pagination__page,
    .doc-pagination__ellipsis {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
}

/* Progress tracker */
.progress-tracker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
}

.progress-step {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: #f5f5f5;
    color: #888;
    font-size: 0.9375rem;
}

.progress-step--done {
    background: #f0fdf4;
    color: #16a34a;
}

.progress-step--active {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 500;
}

.progress-result {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9375rem;
}

.progress-result--rejected {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.progress-result--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

/* Completed pages */
.upload-area--completed {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
}

.upload-area--completed img {
    max-width: 300px;
    max-height: 400px;
    border: 2px solid #86efac;
    border-radius: 6px;
}

.upload-area--completed iframe {
    width: 100%;
    height: 80vh;
    border: 2px solid #86efac;
    border-radius: 6px;
}

/* Result cards */
.result-pages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-card {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 1rem;
}

.result-card__image {
    max-width: 300px;
    max-height: 400px;
    border: 2px solid #86efac;
    border-radius: 6px;
    flex-shrink: 0;
}

.result-card__fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.result-card__row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.result-card__label {
    font-size: 0.8125rem;
    color: #666;
}

.result-card__value {
    font-size: 1rem;
    font-weight: 500;
    color: #1a1a1a;
}

@media (max-width: 768px) {
    .result-card {
        flex-direction: column;
    }

    .result-card__image {
        max-width: 100%;
    }
}

/* Camera FAB button */
.camera-fab {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #FFC107;
    color: #212121;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    z-index: 100;
}

.camera-fab:hover {
    background: #FFB300;
}

.camera-fab:active {
    background: #F9A825;
}

.camera-fab:focus-visible {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

.camera-fab--disabled,
.camera-fab:disabled {
    background: #d9d9d9;
    color: #bfbfbf;
    pointer-events: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .camera-fab {
        display: flex;
    }
}
