/* Python Official Branding - Enhanced Theme Implementation */

:root {
  /* Official Python Colors */
  --python-blue-primary: #3776ab;
  --python-blue-secondary: #306998;
  --python-yellow-primary: #ffd43b;
  --python-yellow-secondary: #ffde57;
  --python-text-dark: #212529;
  --python-text-light: #6c757d;
  --python-bg-light: #f8f9fa;
  --python-bg-white: #ffffff;
  
  /* Dark Mode Python Colors */
  --python-blue-dark: #4a8bc4;
  --python-yellow-dark: #ffd43b;
  --python-bg-dark: #1a1a1a;
  --python-card-dark: #2d2d2d;
}

/* Logo and Branding Updates */
.navbar-brand .fab.fa-python,
.fab.fa-python.text-warning,
.fab.fa-python {
    color: var(--python-yellow-primary) !important;
    text-shadow: 0 0 5px rgba(255, 212, 59, 0.3);
}

.navbar-brand {
    color: var(--python-blue-primary) !important;
    font-weight: 600;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

.navbar-nav .nav-link {
    color: #e9ecef !important;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--python-yellow-primary) !important;
}

.navbar-nav .nav-link:focus {
    color: var(--python-yellow-primary) !important;
}

/* Python Brand Text Colors */
.text-warning {
    color: var(--python-yellow-primary) !important;
}

.text-info {
    color: var(--python-blue-primary) !important;
}

.text-python-blue {
    color: var(--python-blue-primary) !important;
}

.text-python-yellow {
    color: var(--python-yellow-primary) !important;
}

/* Improve contrast for feature icons */
.fas.text-primary {
    color: var(--python-blue-primary) !important;
    filter: brightness(1.2) saturate(1.1);
}

.fas.text-success,
.fas.text-warning,
.fas.text-info {
    filter: brightness(1.2) saturate(1.1);
}

/* Enhanced Lesson Cards - Python Theme */
.lesson-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(55, 118, 171, 0.2);
    background: linear-gradient(135deg, rgba(55, 118, 171, 0.05) 0%, rgba(0, 0, 0, 0.8) 100%);
    position: relative;
    overflow: hidden;
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(55, 118, 171, 0.2);
    border-color: var(--python-blue-primary);
}

.lesson-card.completed-lesson {
    border-color: var(--python-blue-primary);
    box-shadow: 0 0 15px rgba(55, 118, 171, 0.3);
}

.lesson-card.completed-lesson:hover {
    box-shadow: 0 10px 25px rgba(55, 118, 171, 0.3);
}

.lesson-card.premium-locked {
    border-color: var(--python-yellow-primary);
    background: linear-gradient(135deg, rgba(255, 212, 59, 0.1) 0%, rgba(0, 0, 0, 0.8) 100%);
}

.lesson-card.premium-locked:hover {
    box-shadow: 0 10px 25px rgba(255, 212, 59, 0.2);
}

/* Difficulty indicators with icons */
.difficulty-indicator .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    border-radius: 20px;
}

/* Progress indicators */
.lesson-card .position-absolute .badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Welcome Message Animations */
.welcome-message {
    animation: slideInFromTop 1s ease-out;
}

.welcome-icon {
    animation: bounceIn 1.5s ease-out;
}

.welcome-title {
    animation: fadeInUp 1s ease-out 0.3s both;
}

.welcome-subtitle {
    animation: fadeInUp 1s ease-out 0.6s both;
}

/* Animated Message Bubbles */
.animated-message {
    animation: slideInFromLeft 0.8s ease-out both;
    opacity: 0;
}

/* Pulse Button Animation */
.pulse-btn {
    animation: gentlePulse 3s ease-in-out infinite;
}

.pulse-btn:hover {
    animation: none;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #6c757d;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* New Message Animation */
.new-message {
    animation: slideInFromBottom 0.5s ease-out;
}

/* Keyframes */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(180deg);
    }
    70% {
        transform: scale(0.9) rotate(360deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(360deg);
    }
}

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

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes gentlePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 8px rgba(0, 123, 255, 0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Lesson stats styling */
.lesson-stats .badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    border-radius: 15px;
}

/* Prerequisites styling */
.prerequisites {
    border-left: 3px solid rgba(0, 123, 255, 0.3);
    padding-left: 0.75rem;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 0 5px 5px 0;
}

/* Button enhancements */
.lesson-btn {
    transition: all 0.2s ease;
    font-weight: 500;
    border-radius: 20px;
}

.lesson-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Progress bar enhancements */
.progress {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

/* Python Theme Progress Bars */
.progress-bar {
    background: linear-gradient(90deg, var(--python-blue-primary) 0%, var(--python-yellow-primary) 50%, var(--python-blue-secondary) 100%);
    transition: width 0.6s ease;
    border-radius: 10px;
}

/* Crown icon animation for premium content - Python Theme */
.fas.fa-crown {
    animation: python-glow 2s ease-in-out infinite alternate;
}

@keyframes python-glow {
    from { 
        text-shadow: 0 0 5px var(--python-yellow-primary), 0 0 10px var(--python-yellow-primary); 
        color: var(--python-yellow-primary);
    }
    to { 
        text-shadow: 0 0 10px var(--python-yellow-secondary), 0 0 20px var(--python-yellow-secondary); 
        color: var(--python-yellow-secondary);
    }
}

/* Learning progress dashboard - Python Theme */
.card.border-primary {
    border-width: 2px;
    border-color: var(--python-blue-primary) !important;
    background: linear-gradient(135deg, rgba(55, 118, 171, 0.1) 0%, rgba(0, 0, 0, 0.8) 100%);
}

/* Responsive improvements for lesson cards */
@media (max-width: 768px) {
    .lesson-card {
        margin-bottom: 1rem;
    }
    
    .lesson-card:hover {
        transform: none;
    }
    
    .lesson-stats .badge {
        font-size: 0.65rem;
        margin-bottom: 0.25rem;
    }
}

/* Badge Mini Display Styles */
.badge-mini {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.badge-mini:hover {
    transform: scale(1.1);
}

/* Primary Button Updates - Python Theme */
.btn-primary {
    background: linear-gradient(135deg, var(--python-blue-primary) 0%, var(--python-blue-secondary) 100%);
    border-color: var(--python-blue-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--python-blue-secondary) 0%, var(--python-blue-primary) 100%);
    border-color: var(--python-blue-secondary);
}

/* Success/Warning Buttons - Python Theme */
.btn-success {
    background: linear-gradient(135deg, var(--python-blue-primary) 0%, #28a745 100%);
}

.btn-warning {
    background: linear-gradient(135deg, var(--python-yellow-primary) 0%, var(--python-yellow-secondary) 100%);
    color: var(--python-text-dark);
}

/* Navigation Tab Updates - Python Theme */
.nav-tab.active, .nav-tab:hover {
    color: var(--python-yellow-primary);
    background: rgba(55, 118, 171, 0.1);
}

/* Alert Components - Python Theme */
.alert-info {
    background-color: rgba(55, 118, 171, 0.1);
    border-color: var(--python-blue-primary);
    color: var(--python-blue-primary);
}

.alert-success {
    background-color: rgba(55, 118, 171, 0.1);
    border-color: var(--python-blue-primary);
}

/* Form Elements - Python Theme */
.form-control:focus, .form-select:focus {
    border-color: var(--python-blue-primary);
    box-shadow: 0 0 0 0.2rem rgba(55, 118, 171, 0.25);
}

/* Chat Interface - Python Theme */
.ai-bubble {
    background: linear-gradient(135deg, rgba(55, 118, 171, 0.1) 0%, rgba(55, 118, 171, 0.05) 100%);
    border-left: 3px solid var(--python-blue-primary);
}

.user-bubble {
    background: linear-gradient(135deg, rgba(255, 212, 59, 0.1) 0%, rgba(255, 212, 59, 0.05) 100%);
    border-right: 3px solid var(--python-yellow-primary);
}

/* Badge System - Python Colors */
.badge-primary {
    background-color: var(--python-blue-primary);
}

.badge-warning {
    background-color: var(--python-yellow-primary);
    color: var(--python-text-dark);
}

/* Python Logo Styling */
.python-logo-main {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.python-logo-main:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(55, 118, 171, 0.4);
}

/* Python Brand Typography */
.display-4, .display-5 {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-weight: 600;
}

/* Mobile optimizations for Python logo */
@media (max-width: 768px) {
    .python-logo-main {
        max-width: 150px;
    }
    
    .nav-tab.active, .nav-tab:hover {
        background: rgba(55, 118, 171, 0.15);
    }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    .text-python-brand {
        color: var(--python-blue-dark) !important;
    }
}

.badge-mini.rarity-common { 
    background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%); 
    border-color: #4CAF50;
}
.badge-mini.rarity-rare { 
    background: linear-gradient(135deg, #2196F3 0%, #64B5F6 100%); 
    border-color: #2196F3;
}
.badge-mini.rarity-epic { 
    background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%); 
    border-color: #9C27B0;
}
.badge-mini.rarity-legendary { 
    background: linear-gradient(135deg, #FF9800 0%, #FFB74D 100%); 
    border-color: #FF9800;
}
.badge-mini.rarity-mythic { 
    background: linear-gradient(135deg, #F44336 0%, #EF5350 100%); 
    border-color: #F44336;
}

.badge-mini-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 50%;
}

.badge-mini-icon {
    font-size: 1.5rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Chat Message Bubbles */
.user-bubble {
    background: #0d6efd;
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.ai-bubble {
    background: #2d3748;
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 70%;
    word-wrap: break-word;
    margin-left: 8px;
    border: 1px solid #4a5568;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bs-info);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    line-height: 1.4;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #ffd43b;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

/* Code copy button */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.message-content pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffd43b;
}

.code-copy-btn.copied {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

/* Inline code container and copy button */
.inline-code-container {
    position: relative;
    display: inline-block;
}

.inline-code-copy-btn {
    position: absolute;
    top: -2px;
    right: -2px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.inline-code-container:hover .inline-code-copy-btn {
    opacity: 1;
}

.inline-code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffd43b;
}

.inline-code-copy-btn.copied {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

/* Copy button styles for lessons */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffd43b;
}

.code-copy-btn.copied {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

/* Code Sandbox Styles */
.code-sandbox {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
}

.code-sandbox textarea {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    resize: vertical;
}

.code-sandbox textarea:focus {
    border-color: #ffd43b;
    box-shadow: 0 0 0 0.2rem rgba(255, 212, 59, 0.25);
}

#codeOutput {
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    line-height: 1.4;
}

/* Mini Sandbox for Premium Previews */
.mini-sandbox .mini-editor {
    border: none;
    resize: none;
}

.mini-sandbox .mini-output {
    font-size: 11px;
    line-height: 1.3;
    overflow-x: auto;
}

/* Mini Code Sandbox in AI Chat */
.mini-code-sandbox {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 1rem;
}

.mini-code-editor {
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(255, 255, 255, 0.2);
    resize: vertical;
    background: #1a1a1a !important;
    color: #e2e8f0 !important;
}

.mini-code-editor:focus {
    border-color: #ffd43b;
    box-shadow: 0 0 0 0.2rem rgba(255, 212, 59, 0.25);
}

.mini-code-output {
    border: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.4;
    background: #1a1a1a !important;
}

/* Typing indicator animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.typing-indicator span {
    height: 6px;
    width: 6px;
    background: var(--bs-info);
    border-radius: 50%;
    display: inline-block;
    margin: 0 1px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Smooth scrolling for chat messages */
#chat-messages {
    scroll-behavior: smooth;
}

/* Input focus styles */
#message-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .user-bubble,
    .ai-bubble {
        max-width: 85%;
    }
    
    .ai-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Homepage animations */
.display-4 {
    animation: fadeInUp 0.8s ease-out;
}

.lead {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.btn-primary {
    animation: fadeInUp 0.8s ease-out 0.4s both;
    transition: transform 0.2s ease;
}

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

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

/* Feature cards animation */
.row .col-md-4 {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.row .col-md-4:nth-child(2) {
    animation-delay: 0.7s;
}

.row .col-md-4:nth-child(3) {
    animation-delay: 0.8s;
}

/* Clear chat button styling */
.btn-outline-danger.btn-sm {
    transition: all 0.2s ease;
    border-color: rgba(220, 53, 69, 0.5);
    color: #dc3545;
}

.btn-outline-danger.btn-sm:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Custom scrollbar for chat */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
