/* Reset y Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.section {
    display: none;
    animation: fadeIn 0.5s;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 3rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
}

.hero-content {
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.hero-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.stat-content h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Quick Access */
.quick-access {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.quick-access h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.quick-link-btn {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s;
}

.quick-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-link-btn i {
    font-size: 1.5rem;
}

/* Section Header */
.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Modules Container */
.modules-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.module-card {
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.module-header {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
    color: white;
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.module-header:hover {
    background: linear-gradient(135deg, #059669, var(--secondary-color));
}

.module-header h3 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.module-toggle {
    font-size: 1.5rem;
    transition: transform 0.3s;
}

.module-card.expanded .module-toggle {
    transform: rotate(180deg);
}

.module-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.module-card.expanded .module-content {
    max-height: 2000px;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

.table-item {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.table-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.table-item h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Search Container */
.search-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.search-box {
    position: relative;
    margin-bottom: 2rem;
}

.search-box i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

#search-input {
    width: 100%;
    padding: 1rem 3.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
}

.clear-btn:hover {
    color: var(--danger-color);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-result-item {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.3s;
}

.search-result-item:hover {
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.search-result-header {
    margin-bottom: 0.75rem;
}

.search-result-type {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-type.type-module {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.search-result-type.type-table {
    background-color: #E0E7FF;
    color: #4C1D95;
}

.search-result-type.type-column {
    background-color: #D1FAE5;
    color: #065F46;
}

.search-result-item h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.search-result-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.search-result-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.search-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.search-empty p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.search-empty small {
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.info-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-card h4 {
    margin: 1.5rem 0 0.75rem;
    color: var(--text-primary);
}

.info-card dl {
    display: grid;
    gap: 1rem;
}

.info-card dt {
    font-weight: 600;
    color: var(--text-primary);
}

.info-card dd {
    color: var(--text-secondary);
    margin-left: 0;
    padding-left: 1rem;
    border-left: 3px solid var(--primary-color);
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-card li i {
    color: var(--secondary-color);
}

/* Modal Mejorado */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: -1;
}

.modal-container {
    background: var(--bg-card);
    border-radius: 1.5rem;
    max-width: 1200px;
    width: 100%;
    max-height: calc(100vh - 4rem);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-color) 100%);
    flex-shrink: 0;
}

.modal-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-icon {
    font-size: 2rem;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    word-wrap: break-word;
    max-width: 800px;
}

.modal-close {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Información de la Tabla */
.table-info-card {
    background: linear-gradient(135deg, #EBF4FF 0%, #E0F2FE 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.info-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.info-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.count-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.info-text {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1rem;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Diagrama ER */
.diagram-section {
    background: var(--bg-color);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2.5rem;
    border: 2px solid var(--border-color);
}

.diagram-container {
    margin-top: 1.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-md);
}

.diagram-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
    transition: transform 0.3s;
}

.diagram-image:hover {
    transform: scale(1.02);
}

/* Sección de Columnas */
.columns-section {
    background: var(--bg-color);
    border-radius: 1rem;
    padding: 2rem;
}

.columns-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.column-card {
    background: white;
    border-radius: 0.875rem;
    border: 2px solid var(--border-color);
    padding: 1.75rem;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.column-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.column-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-color);
}

.column-number {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.column-name-section {
    flex: 1;
    min-width: 0;
}

.column-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.column-type {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.column-type i {
    color: var(--secondary-color);
}

.column-body {
    display: grid;
    gap: 1.25rem;
}

.column-description {
    background: var(--bg-color);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border-left: 3px solid var(--secondary-color);
}

.column-description-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.column-description-title i {
    color: var(--secondary-color);
}

.column-description-text {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.column-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.column-detail-item {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.75rem;
}

.column-detail-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.column-detail-label i {
    font-size: 0.875rem;
}

.column-detail-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.column-detail-item.highlight {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-left: 3px solid var(--accent-color);
}

.column-detail-item.highlight .column-detail-label {
    color: #92400E;
}

.column-detail-item.highlight .column-detail-value {
    color: #78350F;
}

/* Empty State */
.empty-columns {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-columns i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-columns p {
    font-size: 1.1rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

.footer p {
    margin: 0.25rem 0;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        width: 100%;
        justify-content: space-around;
    }

    .nav-link {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmin(150px, 1fr));
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .quick-links {
        grid-template-columns: 1fr;
    }

    .tables-grid {
        grid-template-columns: 1fr;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .modal-container {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .column-details-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
