:root {
    --primary: #0078d4;
    --primary-dark: #005a9e;
    --success: #107c10;
    --danger: #d13438;
    --warning: #ff8c00;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #323130;
    --text-light: #605e5c;
    --border: #edebe9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.5rem;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.upload-area {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f0f8ff;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: #e6f2ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-light);
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.file-info {
    margin-top: 15px;
    font-weight: 600;
    color: var(--success);
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
    margin-right: 10px;
}

.btn-secondary:hover {
    background: #d2d0ce;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
}

.result-actions {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-preview {
    background: #f9f9f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 25px;
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.8;
}

.summary-preview h1 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.summary-preview h2 {
    color: var(--text);
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.summary-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.summary-preview table th,
.summary-preview table td {
    border: 1px solid var(--border);
    padding: 10px;
    text-align: left;
}

.summary-preview table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: var(--primary);
    background: #f9f9f9;
    transform: translateX(5px);
}

.history-item-date {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.history-item-subject {
    color: var(--text);
    font-size: 1rem;
}

.history-item-meta {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 5px;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px 0;
    color: var(--text-light);
}

footer .small {
    font-size: 0.85rem;
    margin-top: 10px;
}

.loading {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 20px;
    }

    .upload-area {
        padding: 40px 15px;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

/* Editor de resumen */
.summary-editor {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
}

.summary-editor:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5rem;
}

.modal-close {
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 25px;
}

.modal-note {
    background: #f0f8ff;
    border-left: 4px solid var(--primary);
    padding: 12px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer .btn {
    min-width: 120px;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* Botón eliminar en historial */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.history-item-content {
    flex: 1;
    cursor: pointer;
}

.history-item-delete {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s;
    opacity: 0.6;
}

.history-item-delete:hover {
    background: #dc3545;
    opacity: 1;
    transform: scale(1.1);
}

.history-item:hover .history-item-delete {
    opacity: 1;
}
