/* Estilos personalizados para el Dashboard Yachasun */

:root {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --sidebar-width: 250px;
    --header-height: 70px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    color: #334155;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h4 {
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.sidebar .nav {
    padding: 1rem 0;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    border: none;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

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

.sidebar .nav-link.active {
    color: white;
    background-color: var(--primary-color);
    border-right: 3px solid #60a5fa;
}

.sidebar .nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Content */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-left: 4px solid var(--primary-color);
}

.stats-card.success {
    border-left-color: var(--success-color);
}

.stats-card.warning {
    border-left-color: var(--warning-color);
}

.stats-card.danger {
    border-left-color: var(--danger-color);
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stats-label {
    color: var(--secondary-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.stats-icon {
    font-size: 2.5rem;
    opacity: 0.3;
    color: var(--primary-color);
}

/* Tables */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    border: none;
}

/* Forms */
.form-control {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Modals */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    font-weight: 600;
    color: #1f2937;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* Pagination */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.page-link {
    border-radius: 8px;
    margin: 0 0.25rem;
    border: 1px solid #e2e8f0;
    color: var(--primary-color);
}

.page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content {
        padding: 1rem;
    }
    
    .header {
        padding: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

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

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #64748b;
}

.empty-state p {
    color: #94a3b8;
}

/* ===== ESTILOS ESPECÍFICOS PARA MUNDOS ===== */

/* Imágenes de mundos */
.world-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.no-image {
    display: inline-block;
    width: 50px;
    height: 50px;
    background-color: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    text-align: center;
    line-height: 46px;
    font-size: 0.75rem;
    color: #64748b;
}

/* Badges de nivel de dificultad */
.level-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.level-easy {
    background-color: #dcfce7;
    color: #166534;
}

.level-normal {
    background-color: #dbeafe;
    color: #1e40af;
}

.level-hard {
    background-color: #fef3c7;
    color: #92400e;
}

.level-expert {
    background-color: #fecaca;
    color: #991b1b;
}

/* Celdas de recompensas */
.rewards-cell {
    font-size: 0.875rem;
}

.reward-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    gap: 0.5rem;
}

.reward-item:last-child {
    margin-bottom: 0;
}

.reward-item i {
    width: 16px;
    text-align: center;
    color: #f59e0b;
}

.reward-item i.fa-coins {
    color: #eab308;
}

.reward-item i.fa-trophy {
    color: #8b5cf6;
}

/* Celdas de descripción */
.description-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== ESTILOS ESPECÍFICOS PARA MASCOTAS ===== */

/* Imágenes de mascotas */
.pet-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
}

/* Badges de rareza */
.rarity-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rarity-common {
    background-color: #f1f5f9;
    color: #475569;
}

.rarity-rare {
    background-color: #dbeafe;
    color: #1e40af;
}

.rarity-epic {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.rarity-legendary {
    background-color: #fef3c7;
    color: #92400e;
}

.rarity-mystical {
    background-color: #fecaca;
    color: #991b1b;
}

/* Badges de categoría */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-animal {
    background-color: #ecfdf5;
    color: #059669;
}

.category-fantasy {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.category-robot {
    background-color: #f1f5f9;
    color: #475569;
}

.category-magic {
    background-color: #fef3c7;
    color: #92400e;
}

/* ===== ESTILOS RESPONSIVOS ===== */

@media (max-width: 768px) {
    .world-image,
    .pet-image {
        width: 40px;
        height: 40px;
    }
    
    .no-image {
        width: 40px;
        height: 40px;
        line-height: 36px;
    }
    
    .description-cell {
        max-width: 150px;
    }
    
    .rewards-cell {
        font-size: 0.75rem;
    }
    
    .reward-item {
        gap: 0.25rem;
    }
    
    .reward-item i {
        width: 14px;
    }
}

/* Rankings Styles */
.rankings-page {
    padding: 0;
}

.ranking-row {
    transition: all 0.2s ease;
}

.ranking-row:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ranking-row td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
}

.ranking-row .badge {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.ranking-row .avatar {
    font-weight: 600;
    font-size: 0.875rem;
}

.ranking-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.ranking-stats .stat-item {
    text-align: center;
}

.ranking-stats .stat-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ranking-stats .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.position-badge {
    font-weight: 700;
    min-width: 2.5rem;
    text-align: center;
}

.position-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e) !important;
    color: #333 !important;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.position-2 {
    background: linear-gradient(135deg, #c0c0c0, #e5e5e5) !important;
    color: #333 !important;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.3);
}

.position-3 {
    background: linear-gradient(135deg, #cd7f32, #daa520) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.3);
}

.ranking-filters {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.ranking-table {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ranking-table .table {
    margin-bottom: 0;
}

.ranking-table .table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    padding: 1rem 0.75rem;
}

.ranking-table .table tbody tr {
    border-bottom: 1px solid #f1f3f4;
}

.ranking-table .table tbody tr:last-child {
    border-bottom: none;
}

.ranking-table .table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.user-details h6 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.user-details small {
    color: #6c757d;
    font-size: 0.75rem;
}

.ranking-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.ranking-value i {
    font-size: 1.1rem;
}

.experience-value {
    color: #ffc107;
}

.books-value {
    color: #007bff;
}

.level-badge {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.school-badge {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.classroom-badge {
    background: #6c757d;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.last-activity {
    font-size: 0.75rem;
    color: #6c757d;
}

.empty-rankings {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.empty-rankings i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-rankings h3 {
    margin-bottom: 0.5rem;
    color: #495057;
}

.empty-rankings p {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .ranking-table .table {
        font-size: 0.875rem;
    }
    
    .ranking-table .table td,
    .ranking-table .table th {
        padding: 0.5rem 0.25rem;
    }
    
    .user-info {
        gap: 0.5rem;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .ranking-filters .row {
        gap: 1rem;
    }
}

/* Resources Component Styles */
.resource-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e2e8f0;
}

.resource-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.resource-image {
    height: 200px;
    object-fit: cover;
    border-radius: 0.375rem 0.375rem 0 0;
}

.resource-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.375rem;
}

.resource-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 0.375rem 0.375rem 0 0;
}

.resource-card:hover .resource-overlay {
    opacity: 1;
}

.resource-overlay .btn-group-vertical {
    gap: 0.5rem;
}

.resource-overlay .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Backdrop */
.modal.show {
    background-color: rgba(0, 0, 0, 0.5);
}

/* File Upload Styles */
.file-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s ease;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.05);
}

/* Responsive adjustments for resources */
@media (max-width: 768px) {
    .resource-image {
        height: 150px;
    }
    
    .resource-thumbnail {
        width: 40px;
        height: 40px;
    }
}
