:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: #f8fafc;
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at top right, #eef2ff, #f8fafc);
}

header {
    max-width: 1000px;
    margin: 0 auto 3rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.doc-card {
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12);
}

.doc-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: #eef2ff;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.doc-icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.doc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.doc-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.doc-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.view-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.2s;
}

.view-btn:hover {
    border-color: var(--primary);
    background: #f5f3ff;
}

/* FAB - Floating Action Button */
.fab {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab:hover {
    transform: scale(1.05) translateY(-5px);
    background: var(--primary-hover);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.5);
}

.fab svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.scan-status {
    text-align: center;
    padding: 2rem 0;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid #eef2ff;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preview-area {
    width: 100%;
    text-align: center;
}

#pdfPreview {
    width: 100%;
    max-height: 400px;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.primary-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    background: #f1f5f9;
    color: var(--text-main);
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.primary-btn:hover { background: var(--primary-hover); }
.secondary-btn:hover { background: #e2e8f0; }

.no-files {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-files img {
    width: 15rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

/* Response messaging */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: #1e293b;
    color: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    animation: toastSlide 0.3s forwards;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.actions-bar {
    max-width: 1000px;
    margin: -1rem auto 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.actions-bar .fab {
    position: static;
    bottom: auto;
    right: auto;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    border-radius: 0.75rem;
    box-shadow: none;
}

.document-list {
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    border-collapse: collapse;
    overflow: hidden;
}
.document-list thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
}
.document-list th,
.document-list td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.document-list tr:last-child td {
    border-bottom: none;
}
.document-list .doc-name-cell {
    font-weight: 600;
    color: var(--text-main);
}
