/* ==================== RESET Y VARIABLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores oficiales Novae IA */
    --primary-color: #ef771b;
    --primary-hover: #d86a17;
    --secondary-color: #2E4C9B;
    --secondary-hover: #243d7d;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-dark: #0f0f0f;
    --text-dark: #1a1a1a;
    --text-gray: #64748b;
    --border-color: #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);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* ==================== TIPOGRAFÍA ==================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-container {
    min-height: calc(100vh - 180px);
    padding: 2rem 0;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo p {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
}

.system-status {
    text-align: right;
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.status-badge.ready {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==================== NAVEGACIÓN ==================== */
.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

.user-greeting {
    color: var(--primary-color);
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: rgba(239, 119, 27, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 119, 27, 0.3);
}

/* Botón en header */
.header-nav .btn {
    padding: 0.5rem 1.25rem;
}

/* ==================== ALERTAS ==================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error, .alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.alert .close:hover {
    opacity: 1;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.5rem;
    font-style: italic;
}

.card-body {
    padding: 2rem;
}

/* ==================== FORMULARIOS ==================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.form-grid.three-cols {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--bg-white);
}

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

.form-group textarea {
    resize: vertical;
    line-height: 1.6;
}

.form-group input:required,
.form-group textarea:required {
    border-left: 3px solid var(--primary-color);
}

/* ==================== BOTONES ==================== */
.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.25rem;
}

.btn-primary,
input[type="submit"].btn-primary,
button.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover)) !important;
    color: white !important;
    box-shadow: var(--shadow-sm);
    border: none;
}

.btn-primary:hover:not(:disabled),
input[type="submit"].btn-primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-hover), #c45a10) !important;
}

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

.btn-secondary,
input[type="submit"].btn-secondary,
button.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-hover)) !important;
    color: white !important;
    box-shadow: var(--shadow-sm);
    border: none;
}

.btn-secondary:hover:not(:disabled),
input[type="submit"].btn-secondary:hover:not(:disabled),
button.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--secondary-hover), #1e3366) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Botón de éxito (verde) */
.btn-success,
input[type="submit"].btn-success,
button.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669) !important;
    color: white !important;
    box-shadow: var(--shadow-sm);
    border: none;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--text-gray);
}

/* ==================== PROGRESO ==================== */
.progress-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4), 0 0 0 1px rgba(255,255,255,0.1);
    margin: 2rem 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideInDown 0.5s ease-out, pulse 2s ease-in-out infinite;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4), 0 0 0 1px rgba(255,255,255,0.1);
    }
    50% {
        box-shadow: 0 10px 60px rgba(102, 126, 234, 0.6), 0 0 0 2px rgba(255,255,255,0.3);
    }
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.spinner-container {
    flex-shrink: 0;
}

.spinner-container .spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.progress-details {
    flex: 1;
}

.progress-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.progress-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.125rem;
    font-weight: 500;
    margin: 0 0 1rem 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
    border-radius: 999px;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    animation: shimmer 2s ease-in-out infinite;
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-percentage {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Responsive para pantallas pequeñas */
@media (max-width: 768px) {
    .progress-info {
        flex-direction: column;
        text-align: center;
    }

    .spinner-container .spinner {
        width: 60px;
        height: 60px;
    }

    .progress-title {
        font-size: 1.25rem;
    }

    .progress-text {
        font-size: 1rem;
    }
}

/* ==================== RESULTADOS ==================== */
.results-container {
    margin-top: 3rem;
}

.derechos-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.derecho-item {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-dark);
}

.content-box,
.preview-box {
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 0.9375rem;
    max-height: 600px;
    overflow-y: auto;
}

.preview-box {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 800px;
}

/* ==================== FOOTER ==================== */
.footer {
    background: #1a1a1a;
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
}

.footer p {
    margin: 0.25rem 0;
}

.footer-subtitle {
    font-size: 0.875rem;
    opacity: 0.7;
}

.footer-legal {
    margin-bottom: 1rem;
}

.footer-legal a {
    color: #a5b4fc;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-legal a:hover {
    color: white;
    text-decoration: underline;
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-spinner p {
    font-size: 1.125rem;
    font-weight: 500;
}

/* ==================== SCROLLBAR ==================== */
.content-box::-webkit-scrollbar,
.preview-box::-webkit-scrollbar {
    width: 8px;
}

.content-box::-webkit-scrollbar-track,
.preview-box::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 999px;
}

.content-box::-webkit-scrollbar-thumb,
.preview-box::-webkit-scrollbar-thumb {
    background: var(--text-gray);
    border-radius: 999px;
}

.content-box::-webkit-scrollbar-thumb:hover,
.preview-box::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .system-status {
        text-align: center;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-body {
        padding: 1.5rem;
    }
}

/* ==================== ANIMACIONES ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}

/* ==================== UTILIDADES ==================== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
