/* ===== Asal Font - Custom Font Faces ===== */
@font-face {
    font-family: 'Asal Arabic ITF';
    src: url('../../assets/fonts/Asal Arabic ITF light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Asal Arabic ITF';
    src: url('../../assets/fonts/Asal Arabic ITF Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Asal Arabic ITF';
    src: url('../../assets/fonts/Asal Arabic ITF Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Asal Arabic ITF';
    src: url('../../assets/fonts/Asal Arabic ITF Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Asal Arabic ITF';
    src: url('../../assets/fonts/Asal Arabic ITF Extra Bold.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Asal Arabic ITF';
    src: url('../../assets/fonts/Asal Arabic ITF Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* ===== Studio Portal Global Styles ===== */
:root {
    --primary-black: #0A0A0A;
    --primary-white: #FFFFFF;
    --accent-color: #341114; /* Matareek Dark Red */
    --accent-light: #521b20;
    --dark-gray: #151515;
    --medium-gray: #252525;
    --light-gray: #353535;
    --text-muted: #999999;
    --sidebar-width: 280px;
    --header-height: 70px;
    --main-bg-gradient: linear-gradient(135deg, #200b0d 0%, #0a0a0a 45%, #200b0d 100%);
    --font-arabic: 'Asal Arabic ITF', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-arabic);
}

body {
    background: var(--main-bg-gradient);
    background-color: #0A0A0A; /* Solid fallback to prevent blue flashes */
    background-attachment: fixed;
    color: var(--primary-white);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
}

input, button, textarea, select {
    font-family: var(--font-arabic);
}

::placeholder {
    font-family: var(--font-arabic);
}

/* ===== Page Loader ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--main-bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

.lottie-loader {
    width: 50vw;
    max-width: 400px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lottie-loader svg {
    width: 100% !important;
    height: auto !important;
    display: block;
    filter: brightness(0) invert(1);
}

/* ===== Auth Page Styles ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.auth-card {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 40px;
    border-radius: 0; /* Strict square corners */
    width: 100%;
    aspect-ratio: 1 / 1; /* Guaranteed square */
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.auth-logo img {
    height: 50px;
    margin-bottom: 24px;
    align-self: center;
    filter: brightness(0) invert(1);
}

.auth-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--primary-white);
    margin-bottom: 30px;
}

.auth-form {
    width: 100%;
}

.form-group {
    text-align: right;
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    background: var(--dark-gray);
    border: 1px solid var(--medium-gray);
    padding: 16px;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: var(--accent-color);
}

.auth-submit {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-submit:hover {
    background: var(--accent-light);
}

.auth-footer {
    margin-top: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Dashboard Styles ===== */
.dashboard-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    flex-shrink: 0;
    background: rgba(10, 10, 10, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 30px;
    box-sizing: border-box;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 60px;
}

.sidebar-logo {
    height: 36px;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.nav-item.active {
    background: rgba(52, 17, 20, 0.2);
    color: var(--primary-white);
}

.nav-icon {
    font-size: 20px;
}

.sidebar-footer {
    border-top: 1px solid var(--medium-gray);
    padding-top: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: var(--medium-gray);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-details span {
    display: block;
}

.user-name {
    font-weight: 700;
}

.user-project {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--medium-gray);
    color: var(--text-muted);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

/* Main Content area */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px 60px;
}

.review-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    margin-bottom: 40px;
}

.page-title {
    font-size: 32px;
    margin-bottom: 8px;
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 14px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.file-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s, background 0.3s;
}

.file-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
}

.file-preview {
    height: 160px;
    background: var(--dark-gray);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(52, 17, 20, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 2;
    transition: transform 0.3s;
}

.file-card:hover .play-overlay {
    transform: scale(1.1);
}

.folder-icon {
    font-size: 64px;
}

.file-info {
    padding: 20px;
}

.file-name {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-date {
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Review Page Styles ===== */
.review-page {
    height: 100vh;
    height: 100dvh; /* Support for mobile dynamic height */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--main-bg-gradient) !important;
}

.review-header {
    height: 70px;
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
    z-index: 10;
}

.review-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.review-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.player-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0; /* Prevent flex children from overflowing */
}

.video-title-bar {
    padding: 30px 40px 0 40px;
}

.review-file-name {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: white;
}

.player-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow-y: auto;
    flex: 1;
}

.video-wrapper {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    outline: none !important;
}

.main-video {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    border-radius: 12px;
    outline: none !important;
    border: none !important;
}

iframe {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    outline: none !important;
    border: none !important;
    border-radius: 12px;
}

:focus, :focus-visible, :active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* Global tap highlight reset */
* {
    -webkit-tap-highlight-color: transparent;
}

.comments-panel {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 150px);
    background: rgba(13, 13, 13, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom left;
    overflow: hidden;
}

.comments-panel.collapsed {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

[dir="rtl"] .comments-panel {
    left: 30px;
    right: auto;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--primary-white);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-light);
    transform: rotate(90deg);
}

/* Floating Toggle Button (Chat Bubble) */
.floating-toggle-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1001;
    background: var(--accent-color);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(52, 17, 20, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 24px;
}

.floating-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--accent-light);
}

[dir="rtl"] .floating-toggle-btn {
    right: auto;
    left: 30px;
}

.floating-toggle-btn.visible {
    display: flex;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.comments-header {
    padding: 24px;
    background: #0D0D0D;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.comment-input-area {
    padding: 16px 20px;
    background: #111;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.input-wrapper {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(52, 17, 20, 0.2);
}

#comment-text {
    background: transparent;
    border: none;
    color: white;
    resize: none;
    padding: 8px;
    font-family: var(--font-arabic);
    font-size: 14px;
    min-height: 40px;
    max-height: 120px;
}

#comment-text:focus {
    outline: none;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Branded Download Button */
.btn-download {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 0; /* Square branding */
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
}

.btn-download:hover {
    background: var(--accent-light);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--medium-gray);
    color: var(--primary-white);
    border-color: rgba(255, 255, 255, 0.2);
}

.recording-status {
    color: #ff4757;
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recording-status.hidden {
    display: none;
}

.dot-pulse {
    width: 8px;
    height: 8px;
    background: #ff4757;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.voice-note-player {
    width: 100%;
    margin-top: 10px;
    filter: invert(1) hue-rotate(180deg); /* Style browser audio player for dark theme */
    height: 30px;
}


.comments-count {
    background: var(--accent-color);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.time-editor-wrapper {
    margin-bottom: 12px;
}

.current-time-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #FFFFFF;
    font-weight: 700;
    width: 80px;
    text-align: center;
    font-family: var(--font-arabic);
    transition: all 0.3s ease;
}

.current-time-badge:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 17, 20, 0.2);
}

.voice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.voice-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.send-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--medium-gray);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
}

/* RTL Helpers */
[dir="rtl"] .sidebar {
    border-left: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

