/* ============================================
   CAPACHILE - Tema Corporativo Profesional
   Paleta: Morado Oscuro
   ============================================ */

/* === Variables === */
:root {
    --primary: #2D1B69;
    --primary-light: #4A2D8F;
    --primary-dark: #1A0F40;
    --primary-rgb: 45, 27, 105;
    --accent: #7C4DFF;
    --accent-hover: #651FFF;
    --bg-light: #F5F3FA;
    --bg-white: #FFFFFF;
    --text-primary: #1A1A2E;
    --text-secondary: #6B6B80;
    --text-on-dark: #FFFFFF;
    --text-muted: #9E9EB0;
    --success: #28A745;
    --success-light: #D4EDDA;
    --danger: #DC3545;
    --danger-light: #F8D7DA;
    --warning: #FFC107;
    --warning-light: #FFF3CD;
    --info: #17A2B8;
    --info-light: #D1ECF1;
    --border: #E0DCE8;
    --border-light: #F0EDF5;
    --shadow: 0 2px 12px rgba(45, 27, 105, 0.08);
    --shadow-lg: 0 8px 30px rgba(45, 27, 105, 0.12);
    --shadow-hover: 0 4px 20px rgba(45, 27, 105, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-dark);
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.75rem; font-weight: 700; }
h3 { font-size: 1.375rem; font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }

p { margin-bottom: 1rem; }

/* === Layout === */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-sm {
    max-width: 600px;
}

.container-lg {
    max-width: 1400px;
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* === Grid === */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* === Flex Utilities === */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* === Navigation === */
.navbar {
    background: var(--primary-dark);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-on-dark);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.navbar-brand img {
    height: 40px;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
}

.navbar-nav a {
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.navbar-nav .btn {
    color: #fff;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-on-dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }

    .navbar-nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        box-shadow: var(--shadow-lg);
    }

    .navbar-nav.active { display: flex; }

    .navbar-nav a {
        padding: 0.75rem 1rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.4);
}

.btn-secondary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--primary-light);
    color: #fff;
}

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

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

.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
}

.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 2px 10px rgba(124, 77, 255, 0.35);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #218838;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
    color: #fff;
}

.btn-warning {
    background: #f0ad4e;
    color: #fff;
}

.btn-warning:hover {
    background: #ec971f;
    color: #fff;
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn:disabled, .btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* === Cards === */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.card-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Course Card === */
.course-card {
    display: flex;
    flex-direction: column;
}

.course-card .card-img {
    position: relative;
}

.course-card .course-price {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

.course-card .course-modules {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.course-card-img-wrapper {
    position: relative;
    overflow: hidden;
}

.course-card-img-wrapper img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.course-card:hover .course-card-img-wrapper img {
    transform: scale(1.05);
}

/* === Course Prices (Card Badges) === */
.price-badge-discount {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: linear-gradient(135deg, #e53935, #d32f2f);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    z-index: 2;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.4);
}

.price-badge-group {
    position: absolute;
    bottom: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 0.5rem 0.85rem;
    border-radius: 8px 0 0 0;
    z-index: 2;
    box-shadow: -2px -2px 10px rgba(0,0,0,0.15);
}

.price-badge-original {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    text-decoration: line-through;
    line-height: 1;
}

.price-badge-sale {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

/* === Course Detail Prices === */
.course-detail-prices {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-price-original {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.detail-price-sale {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.detail-price-current {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.detail-price-discount {
    background: linear-gradient(135deg, #e53935, #d32f2f);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.3);
}

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* === Alerts === */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    position: relative;
    animation: slideDown 0.3s ease;
}

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

.alert-success { background: var(--success-light); color: #155724; border-left: 4px solid var(--success); }
.alert-error { background: var(--danger-light); color: #721c24; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #856404; border-left: 4px solid var(--warning); }
.alert-info { background: var(--info-light); color: #0c5460; border-left: 4px solid var(--info); }

.alert-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

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

/* === Tables === */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
}

thead th {
    background: var(--primary-dark);
    color: var(--text-on-dark);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-light);
}

tbody td {
    font-size: 0.9rem;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: var(--success-light); color: #155724; }
.badge-danger { background: var(--danger-light); color: #721c24; }
.badge-warning { background: var(--warning-light); color: #856404; }
.badge-info { background: var(--info-light); color: #0c5460; }
.badge-primary { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }

/* === Hero Section === */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: var(--text-on-dark);
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: rgba(124, 77, 255, 0.1);
    border-radius: 50%;
}

.hero h1 {
    color: var(--text-on-dark);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

@media (max-width: 768px) {
    .hero { padding: 2.5rem 0; }
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 1rem; }
}

/* === Section Headers === */
.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    position: relative;
    display: inline-block;
    padding-bottom: 0.75rem;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.section-header p {
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

/* === Footer === */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer h4 {
    color: var(--text-on-dark);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.footer p {
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* === Auth Pages === */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
}

.auth-card .auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .auth-header h1 {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.auth-card .auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-card .auth-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

/* === Progress Bar === */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary-light));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* === Stats Cards === */
.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 2rem;
    list-style: none;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination a {
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .active span {
    background: var(--primary);
    color: #fff;
}

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin-bottom: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* === Utilities === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.85rem; }
.text-lg { font-size: 1.25rem; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }

.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; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.d-none { display: none; }
.d-block { display: block; }

/* === No Cover Image Placeholder === */
.no-cover {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    font-size: 3rem;
}

/* === Responsive Helper === */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    .container { padding: 0 1rem; }
    main { padding: 1.5rem 0; }
}
