/* ═══════════════════════════════════════════════
   Língua Academy — Custom CSS Overrides
   Supplements Tailwind CSS CDN
   ═══════════════════════════════════════════════ */

/* ── Base & Typography ──────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ── Selection ──────────────────────────────── */
::selection {
    background: #2563eb;
    color: #fff;
}

/* ── Animations ─────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 800px; }
}
@keyframes slideUp {
    from { opacity: 1; max-height: 800px; }
    to   { opacity: 0; max-height: 0; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-8px); }
}
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes bounce-in {
    0%   { transform: scale(0.3); opacity: 0; }
    50%  { transform: scale(1.05); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes counter-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Utility Classes ────────────────────────── */
.animate-fade-in       { animation: fadeIn 0.5s ease-out both; }
.animate-fade-in-up    { animation: fadeInUp 0.6s ease-out both; }
.animate-fade-in-down  { animation: fadeInDown 0.5s ease-out both; }
.animate-fade-in-left  { animation: fadeInLeft 0.5s ease-out both; }
.animate-fade-in-right { animation: fadeInRight 0.5s ease-out both; }
.animate-slide-down    { animation: slideDown 0.3s ease-out both; }
.animate-scale-in      { animation: scaleIn 0.3s ease-out both; }
.animate-pulse-soft    { animation: pulse-soft 2s ease-in-out infinite; }
.animate-float         { animation: float 3s ease-in-out infinite; }
.animate-spin-slow     { animation: spin-slow 8s linear infinite; }
.animate-bounce-in     { animation: bounce-in 0.5s ease-out both; }
.animate-counter-up    { animation: counter-up 0.8s ease-out both; }

.animation-delay-100   { animation-delay: 0.1s; }
.animation-delay-200   { animation-delay: 0.2s; }
.animation-delay-300   { animation-delay: 0.3s; }
.animation-delay-400   { animation-delay: 0.4s; }
.animation-delay-500   { animation-delay: 0.5s; }
.animation-delay-600   { animation-delay: 0.6s; }
.animation-delay-700   { animation-delay: 0.7s; }
.animation-delay-800   { animation-delay: 0.8s; }

/* ── Stagger children ──────────────────────── */
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.40s; }

/* ── Transitions ────────────────────────────── */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.transition-fast {
    transition: all 0.15s ease;
}

/* ── Hover Effects ──────────────────────────── */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
.hover-scale {
    transition: transform 0.2s ease;
}
.hover-scale:hover {
    transform: scale(1.03);
}
.hover-glow {
    transition: box-shadow 0.3s ease;
}
.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* ── Card Styles ────────────────────────────── */
.card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* ── Gradient Backgrounds ──────────────────── */
.gradient-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
.gradient-secondary {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}
.gradient-accent {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}
.gradient-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 40%, #7c3aed 100%);
}
.gradient-dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ── Glass Effect ───────────────────────────── */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.glass-dark {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ── Loading Shimmer ────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

/* ── Notification Badge ─────────────────────── */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: #dc2626;
    border-radius: 9999px;
    padding: 0 4px;
}

/* ── Progress Bar ───────────────────────────── */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tooltip ────────────────────────────────── */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #1e293b;
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 50;
}
[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ── Dropdown ───────────────────────────────── */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    min-width: 200px;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border: 1px solid #e2e8f0;
    z-index: 50;
    animation: fadeIn 0.2s ease-out;
}
.dropdown-menu.active {
    display: block;
}

/* ── Modal Backdrop ─────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.active {
    display: flex;
}
.modal-content {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    max-width: 32rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease-out;
}

/* ── Alert Flash Messages ──────────────────── */
.alert-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeInRight 0.3s ease-out;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}
.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.alert-dismiss {
    cursor: pointer;
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 4px;
}
.alert-dismiss:hover {
    opacity: 1;
}

/* ── Star Rating ────────────────────────────── */
.star-rating {
    display: inline-flex;
    gap: 2px;
}
.star-rating .star {
    cursor: pointer;
    transition: transform 0.15s ease;
}
.star-rating .star:hover {
    transform: scale(1.2);
}
.star-rating .star.active svg {
    fill: #f59e0b;
    color: #f59e0b;
}
.star-rating .star svg {
    fill: #e2e8f0;
    color: #e2e8f0;
}

/* ── Accordion ──────────────────────────────── */
.accordion-item {
    border-bottom: 1px solid #e2e8f0;
}
.accordion-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    font-weight: 600;
    color: #1e293b;
    transition: color 0.2s;
}
.accordion-header:hover {
    color: #2563eb;
}
.accordion-header .icon {
    transition: transform 0.3s ease;
}
.accordion-header.active .icon {
    transform: rotate(180deg);
}
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
.accordion-content.active {
    max-height: 500px;
    padding-bottom: 1rem;
}

/* ── Tabs ───────────────────────────────────── */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    gap: 0;
}
.tab-btn {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.tab-btn:hover {
    color: #2563eb;
}
.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}
.tab-panel.active {
    display: block;
}

/* ── Badge ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}
.badge-primary   { background: #eff6ff; color: #2563eb; }
.badge-secondary { background: #f5f3ff; color: #7c3aed; }
.badge-success   { background: #ecfdf5; color: #059669; }
.badge-warning   { background: #fffbeb; color: #d97706; }
.badge-danger    { background: #fef2f2; color: #dc2626; }
.badge-info      { background: #f0f9ff; color: #0284c7; }

/* ── Empty State ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
}
.empty-state svg {
    margin: 0 auto 1rem;
    opacity: 0.4;
}
.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}
.empty-state p {
    font-size: 0.875rem;
}

/* ── Breadcrumb ─────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    flex-wrap: wrap;
}
.breadcrumb a {
    color: #2563eb;
    transition: color 0.15s;
}
.breadcrumb a:hover {
    color: #1d4ed8;
}

/* ── Course Player ──────────────────────────── */
.player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #0f172a;
    border-radius: 0.75rem;
}
.player-wrapper iframe,
.player-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ── Sidebar Nav ────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sidebar-link:hover {
    background: #f1f5f9;
    color: #2563eb;
}
.sidebar-link.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* ── Table Styles ───────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table thead {
    background: #f8fafc;
}
.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
}
.data-table td {
    padding: 0.75rem 1rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Scroll to Top ──────────────────────────── */
#scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 30;
}
#scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}
#scroll-to-top:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

/* ── Loading Spinner ────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin-slow 0.6s linear infinite;
}
.spinner-primary {
    border-color: rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
}

/* ── Form Styles ────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}
.form-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

/* ── Search Autocomplete ────────────────────── */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    border: 1px solid #e2e8f0;
    border-top: none;
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}
.search-autocomplete.active {
    display: block;
}
.search-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}
.search-autocomplete-item:hover {
    background: #f1f5f9;
}
.search-autocomplete-item img {
    width: 40px;
    height: 40px;
    border-radius: 0.375rem;
    object-fit: cover;
}

/* ── Print Styles ───────────────────────────── */
@media print {
    header, footer, nav, .sidebar, .no-print,
    #scroll-to-top, .alert-container {
        display: none !important;
    }
    body {
        background: #fff;
        color: #000;
    }
    a {
        color: #000;
        text-decoration: underline;
    }
}

/* ── Responsive Helpers ─────────────────────── */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .modal-content { width: 95%; border-radius: 0.75rem; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* ── Page Transitions ───────────────────────── */
@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: pageSlideIn 0.38s cubic-bezier(0.4, 0, 0.2, 1) both;
}

#page-transition-overlay {
    position: fixed;
    inset: 0;
    background: #f8fafc;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

#page-transition-overlay.leaving {
    opacity: 1;
    pointer-events: all;
}

@media (prefers-reduced-motion: reduce) {
    main { animation: none; }
    #page-transition-overlay { transition: none; }
}
