/* 
 * ARCHIVO: public_html/css/style.css
 * DESCRIPCIÓN: Estilos principales de la plataforma ElectroLearn
 * UBICACIÓN: /css/style.css
 */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f3f4f6;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 20px;
}

/* Login & Register Screens */
.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    max-width: 400px;
    margin: 0 auto;
    animation: slideUp 0.5s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--dark);
    font-size: 32px;
    margin-bottom: 10px;
}

.login-header p {
    color: #6b7280;
}

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

label {
    display: block;
    margin-bottom: 5px;
    color: var(--dark);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
}

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

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

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

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Messages */
.message-box {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: none;
}

.message-error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.message-success {
    background: #efe;
    color: #080;
    border: 1px solid #cfc;
}

.message-warning {
    background: #ffeaa7;
    color: #d63031;
    border: 1px solid #fdcb6e;
}

/* Dashboard */
.dashboard {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dashboard-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header h1 {
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 20px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

.dashboard-content {
    display: flex;
    min-height: calc(100vh - 120px);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--light);
    padding: 20px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.menu-item {
    padding: 12px 16px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.menu-item:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.menu-item.active {
    background: var(--primary);
    color: white;
}

.badge {
    position: absolute;
    right: 10px;
    background: var(--danger);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Course Cards */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.course-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s;
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.course-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

.course-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-new {
    background: #dbeafe;
    color: #1e40af;
}

.status-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-complete {
    background: #d1fae5;
    color: #065f46;
}

.course-description {
    color: #6b7280;
    margin-bottom: 15px;
    font-size: 14px;
}

.course-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #9ca3af;
}

.course-progress {
    margin-bottom: 10px;
}

.progress-bar {
    background: var(--light);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    background: linear-gradient(90deg, var(--secondary), #34d399);
    height: 100%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
    text-align: right;
}

/* Course Detail */
.course-detail {
    background: white;
    border-radius: 12px;
    padding: 30px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: 500;
}

.back-button:hover {
    text-decoration: underline;
}

.module-list {
    margin-top: 30px;
}

.module {
    background: var(--light);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.module-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-title {
    font-weight: 600;
    color: var(--dark);
}

.module-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
}

.tasks-list {
    padding: 15px;
    display: none;
}

.module.expanded .tasks-list {
    display: block;
}

.task-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: start;
    gap: 15px;
    transition: all 0.3s;
}

.task-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    flex-shrink: 0;
    margin-top: 2px;
}

.task-checkbox.checked {
    background: var(--secondary);
    border-color: var(--secondary);
}

.task-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
}

.task-info {
    flex: 1;
}

.task-name {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 5px;
}

.task-description {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.task-points {
    font-size: 12px;
    color: var(--primary);
    margin-bottom: 5px;
}

.task-resources {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.task-resources a {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    padding: 4px 8px;
    background: #eff6ff;
    border-radius: 4px;
    transition: all 0.3s;
}

.task-resources a:hover {
    background: var(--primary);
    color: white;
}

/* Grades */
.grades-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.grade-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.grade-item {
    text-align: center;
}

.grade-value {
    font-size: 36px;
    font-weight: bold;
}

.grade-label {
    opacity: 0.9;
    margin-top: 5px;
}

/* Materials */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.material-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.material-card h3 {
    color: var(--dark);
    margin-bottom: 15px;
}

.material-card ul {
    list-style: none;
}

.material-card li {
    margin-bottom: 10px;
}

.material-card a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s;
}

.material-card a:hover {
    text-decoration: underline;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--light);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
}

td {
    padding: 15px;
    border-top: 1px solid var(--border);
}

/* Admin Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: #6b7280;
    margin-top: 5px;
}

/* Users Table */
.users-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* Modal */
.modal {
    display: none !important; /* Oculto por defecto */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex !important; /* Visible cuando tiene clase show */
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
    }

    .courses-grid {
        grid-template-columns: 1fr;
    }

    .grade-summary {
        flex-direction: column;
        gap: 20px;
    }

    .materials-grid {
        grid-template-columns: 1fr;
    }
}
