/*
 * Sci Yetu Coding - Custom Styles
 * Aligned with main project design system
 */

/* ==================== Global Layout ==================== */

/* Coding Hub Styles - Match main site background */
.coding-hub {
    min-height: 100vh;
    background-color: #FFFFFF;
    background-image: radial-gradient(#F3E8FF 2.5px, transparent 2.5px), radial-gradient(#F3E8FF 2.5px, transparent 2.5px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

/* Chat, Challenge, Progress Pages */
.coding-chat,
.coding-challenge,
.coding-progress {
    min-height: calc(100vh - 76px);
    background-color: #FFFFFF;
    background-image: radial-gradient(#F3E8FF 2.5px, transparent 2.5px), radial-gradient(#F3E8FF 2.5px, transparent 2.5px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
}

/* ==================== Glass Card Component ==================== */

.coding-glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
    transition: all 0.3s ease;
}

.coding-glass-card:hover {
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.25);
    transform: translateY(-2px);
}

/* ==================== Toast Notification Styles ==================== */

.toast-container {
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 15px;
}

.toast-container .alert-success {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    color: white;
}

.toast-container .alert-error,
.toast-container .alert-danger {
    background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    color: white;
}

.toast-container .alert-warning {
    background: linear-gradient(135deg, #FACC15 0%, #F59E0B 100%);
    color: #1E1B4B;
}

.toast-container .alert-info {
    background: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
    color: white;
}

.toast-container .btn-close {
    filter: brightness(0) invert(1);
}

/* ==================== Components ==================== */

.stat-item {
    padding: 1rem;
}

.stat-item h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4C1D95;
}

/* Level Cards with Glass Effect */
.level-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.4);
}

.level-icon {
    transition: transform 0.3s ease;
}

.level-card:hover .level-icon {
    transform: scale(1.2);
}

/* Project Gradient Button */
.btn-coding-gradient {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    border: none;
    color: white !important;
    padding: 12px 35px;
    border-radius: 50px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-coding-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
    color: white !important;
}

/* Glass Button */
.btn-coding-glass {
    background: white;
    border: 2px solid #8B5CF6;
    color: #8B5CF6 !important;
    border-radius: 50px;
    padding: 10px 30px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-coding-glass:hover {
    background: #8B5CF6;
    color: white !important;
}

/* ==================== Chat Styles ==================== */

.chat-messages {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(243, 232, 255, 0.3);
    border-radius: 15px;
    padding: 1rem;
}

.message {
    padding: 1rem;
    border-radius: 15px;
    animation: fadeIn 0.3s ease;
}

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

.message-user {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    color: white;
}

.message-assistant {
    background: white;
    border: 2px solid rgba(139, 92, 246, 0.2);
}

.message-content {
    max-width: 85%;
}

.message-text {
    line-height: 1.6;
}

.message pre {
    background: #1e1e1e;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
}

.message code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50%;
    color: #8B5CF6;
}

/* ==================== Code Editor Styling ==================== */

.CodeMirror {
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}

/* ==================== Challenge & Progress Cards ==================== */

.card {
    border: 2px solid rgba(139, 92, 246, 0.15);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
}

.card-header {
    border-bottom: 2px solid rgba(139, 92, 246, 0.15);
    font-weight: 700;
}

/* Purple gradient headers */
.bg-primary {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%) !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
}

/* ==================== Progress Bars ==================== */

.progress {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50px;
    height: 25px;
    border: 2px solid rgba(139, 92, 246, 0.2);
}

.progress-bar {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    border-radius: 50px;
}

/* ==================== Badges ==================== */

.badge {
    border-radius: 50px;
    padding: 0.5em 1em;
    font-weight: 600;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #FACC15 0%, #F59E0B 100%) !important;
    color: #1E1B4B !important;
}

.badge.bg-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
}

/* ==================== Output Panel ==================== */

#outputPanel {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#outputPanel .error {
    color: #DC2626;
}

#outputPanel .success {
    color: #10B981;
}

/* ==================== Responsive Adjustments ==================== */

@media (max-width: 768px) {
    .coding-hub,
    .coding-chat,
    .coding-challenge,
    .coding-progress {
        padding-top: 70px !important;
    }

    .stat-item h3 {
        font-size: 1.75rem;
    }

    .level-card {
        padding: 1.5rem;
    }

    .message-content {
        max-width: 95%;
    }

    .CodeMirror {
        height: 150px;
    }
}

/* ==================== Scrollbar Styling ==================== */

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.05);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #8B5CF6;
}

/* ==================== Loading Overlay ==================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 27, 75, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ==================== Utility Classes ==================== */

.text-gradient {
    background: linear-gradient(135deg, #8B5CF6 0%, #D946EF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-purple {
    border-color: #8B5CF6 !important;
}

.shadow-purple {
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15) !important;
}

/* ==================== Table Styles ==================== */

.table-hover tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.05);
}

/* ==================== Footer Spacing ==================== */

.footer {
    margin-top: auto;
}
