/* ===========================================
   AgenciaDocs - Design Moderno e Minimalista
   =========================================== */

/* Reset e Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-background: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 150ms ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-background);
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    background-color: var(--color-background);
}

.btn-download {
    background-color: var(--color-success);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.btn-download:hover {
    background-color: #059669;
}

.btn-mover {
    background-color: var(--color-error);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.btn-mover:hover {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
}

/* Alertas */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background-color: #fef2f2;
    color: var(--color-error);
    border: 1px solid #fecaca;
}

/* ============================================
   Página de Login
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--color-text-muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    transition: all var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    color: var(--color-text-muted);
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 14px;
}

/* Estado vazio */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    color: var(--color-border);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--color-text-muted);
    font-size: 14px;
}

/* Grid de documentos */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 24px;
}

@media (max-width: 560px) {
    .documents-grid {
        grid-template-columns: 1fr;
    }
}

/* Card de documento */
.document-card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: visible;
    transition: all var(--transition);
}

.document-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.document-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-background);
}

.document-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* Imagem do documento */
.document-images {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.image-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    width: 100%;
}

.image-preview {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition), opacity 0.3s ease;
    opacity: 0;
}

.image-preview img.loaded {
    opacity: 1;
}

/* Loading spinner */
.image-preview::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.image-preview:has(img.loaded)::before {
    display: none;
}

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

.image-preview:hover img {
    transform: scale(1.02);
}

.image-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-actions {
    display: flex;
    gap: 8px;
}

.image-name {
    font-size: 13px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer */
.footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 20px 0;
    margin-top: auto;
}

.footer p {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Responsivo */
@media (max-width: 768px) {
    .login-box {
        padding: 30px 24px;
    }

    .header .container {
        flex-direction: column;
        gap: 12px;
    }

    .page-header h2 {
        font-size: 20px;
    }
}
