:root {
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --secondary-color: #64748b;
    /* Slate 500 */
    --background-color: #f8fafc;
    /* Slate 50 */
    --surface-color: #ffffff;
    --text-color: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --success-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */
    --warning-color: #f59e0b;
    /* Amber 500 */
    --radius: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Navigation */
.main-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95rem;
}

nav a:hover {
    color: var(--primary-color);
}

nav .user-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    margin-right: 0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-logout {
    background-color: transparent;
    color: var(--danger-color);
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
}

.btn-logout:hover {
    background-color: #fef2f2;
    border-color: #fecaca;
}

/* Container */
.container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-container h2 {
    margin-bottom: 2rem;
    color: var(--text-color);
    font-weight: 700;
}

.login-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Forms */
.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    background-color: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.menu-item {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid var(--border-color);
}

.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.menu-item i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.menu-item h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.menu-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tables */
.table-container {
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: #f8fafc;
}

/* Actions in Table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.4rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-icon:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon.delete:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Flashes */
.flash {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Logo */
.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

/* Document Form Styles */
fieldset {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

legend {
    font-weight: 600;
    color: var(--primary-color);
    padding: 0 0.5rem;
    font-size: 1.1rem;
}

/* Specific styling for Section 0 (Classification) */
fieldset.classification-card {
    background-color: #f0f9ff;
    /* Light blue tint */
    border-color: #bae6fd;
}

/* Textarea styling overrides for form */
textarea {
    min-height: 100px;
    resize: vertical;
}

/* AI Button Premium Style */
.btn-ai {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.25rem 0.75rem;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(168, 85, 247, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0;
}

.btn-ai:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 10px rgba(168, 85, 247, 0.5);
}

.btn-ai strong {
    font-size: 1.1em;
}

/* Mic Button */
.mic-btn {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 36px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.mic-btn:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.input-tools {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-label-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.input-label-container label {
    margin-bottom: 0;
}

/* Document Preview Styles */
.document-preview-paper {
    background: white;
    padding: 3rem;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    margin: 2rem auto;
    max-width: 21cm;
    min-height: 29.7cm;
    border: 1px solid #e2e8f0;
    font-family: 'Times New Roman', Times, serif;
    color: black;
    line-height: 1.5;
}

.document-preview-paper h2 {
    font-family: 'Arial', sans-serif;
    font-size: 14pt;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    color: #000;
    text-transform: uppercase;
}

.document-preview-paper p {
    font-size: 11pt;
    margin-bottom: 1rem;
    text-align: justify;
}

/* Preview Tables */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 10pt;
    font-family: 'Arial', sans-serif;
}

.preview-table th,
.preview-table td {
    border: 1px solid black;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.preview-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* Grid for Approval Section */
.grid-aprobacion {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

/* Table Inputs */
#tabla-actividades textarea,
#tabla-actividades input,
#tabla-documentos input,
#tabla-anexos input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.btn-add {
    background-color: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add:hover {
    background-color: #059669;
}

.btn-remove {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background-color: var(--danger-color);
    color: white;
}

/* Form Actions */
.form-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}