@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800&display=swap');

/* Custom styles for the MDK7 Arabic interface */

:root {
    --shazam-purple: #8b5cf6;
    --shazam-pink: #ec4899;
    --shazam-ink: #0f172a;
    --shazam-surface: #172033;
}

body {
    font-family: 'Noto Sans Arabic', system-ui, sans-serif;
    background:
        radial-gradient(circle at 86% 0%, rgba(91, 33, 182, 0.13), transparent 28rem),
        var(--bs-body-bg);
}

html[dir="rtl"] {
    direction: rtl;
}

[dir="ltr"] {
    direction: ltr;
    unicode-bidi: isolate;
}

bdi {
    unicode-bidi: isolate;
}

.brand-mark {
    display: inline-flex;
    color: #a78bfa;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: #f8fafc !important;
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: #ffffff !important;
}

.brand-logo {
    display: block;
    width: 2.55rem;
    height: 2.55rem;
    flex: 0 0 auto;
    object-fit: contain;
    border: 1px solid rgba(167, 139, 250, .38);
    border-radius: .55rem;
    background: #f7f8f1;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .08);
}

.brand-mark strong {
    color: #f9a8d4;
}

.recognizer-shell {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(167, 139, 250, 0.24);
    border-radius: 1.75rem;
    background:
        linear-gradient(135deg, rgba(30, 41, 59, 0.97), rgba(20, 25, 45, 0.95)),
        var(--shazam-surface);
    box-shadow: 0 1.5rem 4rem rgba(2, 6, 23, 0.3);
}

.recognizer-glow {
    position: absolute;
    width: 28rem;
    height: 28rem;
    right: -9rem;
    top: -16rem;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.3);
    filter: blur(2rem);
}

.recognizer-content {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
    padding: 3.4rem 1.5rem 2.2rem;
    text-align: center;
}

.recognizer-brand-art {
    display: flex;
    width: 9rem;
    height: 9rem;
    margin: 0 auto 1.2rem;
    padding: .45rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(196, 181, 253, .56);
    border-radius: 1.15rem;
    background: #f7f8f1;
    box-shadow: 0 .75rem 2.25rem rgba(2, 6, 23, .36), 0 0 0 5px rgba(139, 92, 246, .10);
}

.microphone-level-panel {
    margin: .85rem auto 0;
    max-width: 34rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(167, 139, 250, .22);
    border-radius: .9rem;
    background: rgba(11, 16, 31, .45);
    color: #e9e4f5;
    font-size: .88rem;
    text-align: right;
}

.microphone-level-track {
    height: .48rem;
    margin-top: .7rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(221, 214, 254, .13);
}

.microphone-level-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f0b45b, #87d7bf);
    transition: width 90ms linear;
}

.microphone-level-hint {
    margin: .55rem 0 0;
    color: #b8b4c6;
    font-size: .8rem;
}

.microphone-level-hint.is-quiet { color: #f0c37f; }

.recognizer-brand-art img {
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: .72rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: #c4b5fd;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.eyebrow-dot, .status-dot {
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: #a78bfa;
    box-shadow: 0 0 .75rem #a78bfa;
}

.recognizer-content h1 {
    margin: 1rem 0 .65rem;
    color: #f8fafc;
    font-size: clamp(2.4rem, 6vw, 4.7rem);
    font-weight: 800;
    letter-spacing: -.055em;
}

.gradient-text {
    background: linear-gradient(100deg, #c4b5fd, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-copy {
    max-width: 570px;
    margin: 0 auto 2rem;
    color: #a8b3c7;
    font-size: 1.03rem;
    line-height: 1.7;
}

.recognizer-card {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 1.25rem;
    background: rgba(15, 23, 42, .7);
    text-align: right;
}

.drop-zone {
    margin: .55rem;
    padding: 2.4rem 1.25rem 2rem;
    border: 1px dashed rgba(196, 181, 253, .5);
    border-radius: .95rem;
    text-align: center;
    transition: .2s ease;
}

.drop-zone.dragging, .drop-zone:hover {
    border-color: #f9a8d4;
    background: rgba(139, 92, 246, .12);
}

.drop-icon {
    display: grid;
    width: 3.7rem;
    height: 3.7rem;
    margin: 0 auto 1rem;
    place-items: center;
    border-radius: 1.1rem;
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: white;
}

.drop-icon svg {
    width: 1.8rem;
    height: 1.8rem;
}

.drop-zone h2 {
    margin-bottom: .4rem;
    color: #f8fafc;
    font-size: 1.1rem;
}

.drop-zone p {
    margin-bottom: 1.15rem;
    color: #94a3b8;
    font-size: .9rem;
}

.drop-hint {
    margin-top: 1rem;
    color: #64748b;
    font-size: .73rem;
}

.drop-hint svg, .provider-status svg {
    width: .8rem;
    height: .8rem;
}

.recognizer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1.15rem 1rem;
}

.record-button {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .25rem .5rem;
    border: 0;
    background: transparent;
    color: #e2e8f0;
    text-align: right;
}

.record-button:hover .record-icon {
    transform: scale(1.06);
}

.record-button small {
    display: block;
    margin-top: .12rem;
    color: #94a3b8;
    font-size: .72rem;
}

.record-icon {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 1px solid rgba(244, 114, 182, .35);
    border-radius: 50%;
    background: rgba(236, 72, 153, .15);
    color: #f9a8d4;
    transition: transform .2s ease;
}

.record-icon svg {
    width: 1rem;
}

.supported-formats {
    color: #64748b;
    font-size: .68rem;
    letter-spacing: .03em;
}

.provider-status {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1rem;
    color: #8190a8;
    font-size: .74rem;
}

.provider-status.is-ready .status-dot {
    background: #34d399;
    box-shadow: 0 0 .75rem #34d399;
}

.provider-status.is-fallback .status-dot {
    background: #fbbf24;
    box-shadow: 0 0 .75rem #fbbf24;
}

.recognizer-progress, .recognizer-result {
    margin: .55rem;
    padding: 1rem 1.15rem;
    border-radius: .9rem;
    background: rgba(30, 41, 59, .9);
}

.recognizer-progress {
    display: flex;
    align-items: center;
    gap: .9rem;
    color: #e2e8f0;
}

.recognizer-progress span {
    display: block;
    margin-top: .18rem;
    color: #94a3b8;
    font-size: .78rem;
}

.spinner-ring {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
    border: 2px solid rgba(196, 181, 253, .25);
    border-top-color: #c4b5fd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.recognizer-result {
    color: #e2e8f0;
}

.recognition-result-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.recognition-match {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, .2);
}

.recognition-match:first-child {
    padding-top: 0;
}

.recognition-match:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.recognition-rank {
    display: block;
    margin-bottom: .25rem;
    color: #b8a7ff;
}

.recognition-meta .recognition-details {
    color: #b8a7ff;
}

.recognition-art {
    display: grid;
    width: 4.5rem;
    height: 4.5rem;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border-radius: .7rem;
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: white;
}

.recognition-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recognition-meta {
    min-width: 0;
    flex: 1;
}

.recognition-meta h3,
.recognition-meta p {
    overflow-wrap: anywhere;
}

.recognition-meta h3 {
    margin: 0 0 .2rem;
    color: #fff;
    font-size: 1.15rem;
}

.recognition-meta p {
    margin: 0;
    color: #b7c1d2;
}

.recognition-meta small {
    display: block;
    margin-top: .35rem;
    color: #818cf8;
}

.recognition-links {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: 1rem;
}

.recognition-links a {
    font-size: .75rem;
}

.dashboard-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.dashboard-heading h2 {
    margin: .25rem 0 0;
    font-size: 1.45rem;
    letter-spacing: -.025em;
}

.muted-eyebrow {
    color: #64748b;
    font-size: .65rem;
}

.shazam-info {
    border-radius: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Utility classes */
.text-primary-custom {
    color: var(--bs-primary) !important;
}

/* Card enhancements */
.card {
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Statistics cards */
.card .card-body i[data-feather] {
    stroke-width: 1.5;
}

/* Table enhancements */
.table-hover tbody tr:hover {
    background-color: var(--bs-secondary-bg);
}

/* Button groups */
.btn-group .btn {
    border-radius: 0.375rem;
}

.btn-group .btn:not(:last-child) {
    margin-inline-end: 0.25rem;
}

/* Alert customizations */
.alert {
    border: 1px solid transparent;
}

/* Form enhancements */
.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

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

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid var(--bs-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 400px;
}

/* Responsive enhancements */
@media (max-width: 768px) {
    .recognizer-content {
        padding: 2rem 1rem 1.5rem;
    }

    .recognizer-brand-art {
        width: 7.25rem;
        height: 7.25rem;
        margin-bottom: 1rem;
    }

    .recognizer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .choose-audio {
        min-height: 3rem;
        width: 100%;
    }

    .supported-formats {
        padding-inline-start: .5rem;
    }

    .dashboard-heading {
        align-items: flex-start;
        gap: 1rem;
        flex-direction: column;
    }

    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-inline-end: 0;
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 420px) {
    .brand-logo {
        width: 2.25rem;
        height: 2.25rem;
    }

    .recognizer-content h1 {
        font-size: clamp(2rem, 10vw, 2.7rem);
    }

    .drop-zone {
        padding: 1.8rem .85rem 1.5rem;
    }
}

/* Custom pagination */
.pagination .page-link {
    border-radius: 0.375rem;
    margin: 0 0.125rem;
}

.pagination {
    direction: rtl;
}

.form-control,
.form-select {
    text-align: start;
}

.navbar .navbar-toggler {
    margin-inline-start: auto;
}

.alert-dismissible {
    padding-inline-end: 3rem;
}

/* Keep numeric and technical fragments legible without reversing the page flow. */
.card-title,
.badge,
progress,
canvas {
    unicode-bidi: isolate;
}

progress {
    direction: ltr;
}

/* Badge enhancements */
.badge {
    font-size: 0.75em;
}

.badge i[data-feather] {
    stroke-width: 2;
}

/* Footer */
footer {
    border-top: 1px solid var(--bs-border-color);
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 2rem auto;
}

/* Error pages */
.error-page {
    text-align: center;
    padding: 3rem 0;
}

.error-page i[data-feather] {
    stroke-width: 1;
}

/* Dark mode specific adjustments */
[data-bs-theme="dark"] .card {
    background-color: var(--bs-dark);
    border-color: var(--bs-secondary);
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.075);
}

[data-bs-theme="dark"] .alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    border-color: rgba(13, 202, 240, 0.2);
    color: var(--bs-info);
}

/* Animation for icons */
.navbar-brand i[data-feather],
.card-title i[data-feather] {
    transition: transform 0.2s ease-in-out;
}

.navbar-brand:hover i[data-feather] {
    transform: rotate(10deg);
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-indicator.success {
    color: var(--bs-success);
}

.status-indicator.error {
    color: var(--bs-danger);
}

/* Progress bars for charts */
.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position-x: 1rem;
    }
}
