/* =============================================
   Fish Audio Platform - Main Stylesheet
   Dark Mode + Glassmorphism Design
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-pink: #ec4899;
    --gradient-primary: linear-gradient(135deg, #8b5cf6, #3b82f6);
    --gradient-accent: linear-gradient(135deg, #06b6d4, #8b5cf6);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Cairo', 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
}

/* Background animated gradient */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at 20% 50%, rgba(139,92,246,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(59,130,246,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(6,182,212,0.05) 0%, transparent 50%);
    z-index: -1;
    animation: bgPulse 15s ease-in-out infinite alternate;
}
@keyframes bgPulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

a { color: var(--accent-blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-purple); }

/* ---- Layout ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.page-wrapper { min-height: calc(100vh - 80px); padding: 40px 0; }

/* ---- Navbar ---- */
.navbar {
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0 24px;
    height: 70px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.navbar-brand i { font-size: 1.6rem; -webkit-text-fill-color: var(--accent-purple); }
.navbar-nav { display: flex; align-items: center; gap: 8px; list-style: none; }
.navbar-nav a {
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}
.navbar-nav a:hover, .navbar-nav a.active {
    color: var(--text-primary);
    background: var(--bg-glass);
}
.navbar-actions { display: flex; align-items: center; gap: 12px; }
.credit-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-green);
    font-weight: 600;
}
.credit-badge i { color: var(--accent-orange); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover { box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5); color: #fff; }
.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: var(--transition);
}
.card:hover { border-color: rgba(139, 92, 246, 0.3); box-shadow: var(--shadow-glow); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-glass);
}
.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-title i { color: var(--accent-purple); }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 16px center; padding-left: 40px; }

/* ---- Grid ---- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-workspace { grid-template-columns: 1fr 380px; }
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4, .grid-workspace { grid-template-columns: 1fr; }
}

/* ---- Hero Section ---- */
.hero {
    text-align: center;
    padding: 80px 0 60px;
    position: relative;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    line-height: 1.3;
}
.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ---- Feature Cards ---- */
.feature-card {
    text-align: center;
    padding: 40px 24px;
}
.feature-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.8rem;
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}
.feature-card h3 { font-size: 1.1rem; margin-bottom: 10px; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* ---- Emotion Selector ---- */
.emotion-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.emotion-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    color: var(--text-secondary);
}
.emotion-tag:hover { border-color: var(--accent-purple); color: var(--text-primary); }
.emotion-tag.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}
.emotion-tag .emoji { font-size: 1.1rem; }

/* ---- Voice Cards ---- */
.voice-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}
.voice-card:hover { border-color: var(--accent-purple); }
.voice-card.selected { border-color: var(--accent-purple); background: rgba(139,92,246,0.1); }
.voice-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}
.voice-info { flex: 1; min-width: 0; }
.voice-name { font-weight: 600; font-size: 0.95rem; }
.voice-meta { font-size: 0.8rem; color: var(--text-muted); }

/* ---- Audio Player ---- */
.audio-player-container {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 20px;
}
.audio-player-container audio { width: 100%; margin-top: 10px; }

/* ---- File Upload ---- */
.file-upload-zone {
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.file-upload-zone:hover { border-color: var(--accent-purple); background: rgba(139,92,246,0.05); }
.file-upload-zone.dragover { border-color: var(--accent-purple); background: rgba(139,92,246,0.1); }
.file-upload-zone i { font-size: 2.5rem; color: var(--accent-purple); margin-bottom: 12px; }
.file-upload-zone p { color: var(--text-secondary); }
.file-upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- Stats ---- */
.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ---- Table ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.9rem;
}
th {
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}
tr:hover td { background: rgba(255,255,255,0.02); }

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--accent-blue); }

/* ---- Alert ---- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: var(--accent-green); }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--accent-red); }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: var(--accent-blue); }

/* ---- Loading Spinner ---- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 16px;
    color: var(--text-secondary);
}

/* ---- Sidebar (Admin) ---- */
.admin-layout { display: flex; min-height: calc(100vh - 70px); }
.admin-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    padding: 24px 16px;
    flex-shrink: 0;
}
.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 0.9rem;
    transition: var(--transition);
}
.admin-sidebar .nav-link:hover, .admin-sidebar .nav-link.active {
    background: var(--bg-glass);
    color: var(--text-primary);
}
.admin-sidebar .nav-link.active { border-right: 3px solid var(--accent-purple); }
.admin-content { flex: 1; padding: 30px; overflow-y: auto; width: 100%; }

/* ---- Auth Forms ---- */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 70px);
    padding: 40px 20px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-card .card { padding: 40px; }
.auth-title { text-align: center; margin-bottom: 30px; }
.auth-title h2 { font-size: 1.5rem; margin-bottom: 8px; }
.auth-title p { color: var(--text-muted); font-size: 0.9rem; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ---- Tab Navigation ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-glass); margin-bottom: 24px; }
.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-purple); border-bottom-color: var(--accent-purple); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Section Headers ---- */
.section-header { margin-bottom: 30px; }
.section-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.section-header p { color: var(--text-secondary); }

/* ---- Footer ---- */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-glass);
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 60px;
}

/* ---- Pagination ---- */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.pagination a:hover { background: rgba(139,92,246,0.1); color: var(--text-primary); }
.pagination .active { background: var(--gradient-primary); color: #fff; border-color: transparent; }

/* ---- Mobile Menu ---- */
.mobile-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }
@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    .navbar-nav { display: none; position: absolute; top: 70px; right: 0; left: 0; background: var(--bg-secondary); padding: 16px; flex-direction: column; border-bottom: 1px solid var(--border-glass); z-index: 1001; }
    .navbar-nav.show { display: flex; }
    .navbar .container { flex-wrap: wrap; }
    .navbar-actions { display: none; } /* يمكن إخفاؤها في الموبايل أو وضعها داخل القائمة */
    .navbar-nav.show ~ .navbar-actions { display: flex; position: absolute; top: 180px; right: 0; left: 0; background: var(--bg-secondary); justify-content: center; padding: 10px; border-bottom: 1px solid var(--border-glass); z-index: 1001; }
    
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; border-left: none; border-bottom: 1px solid var(--border-glass); padding: 10px; display: flex; overflow-x: auto; white-space: nowrap; }
    .admin-sidebar .nav-link { margin-bottom: 0; margin-left: 10px; border-right: none; border-bottom: 2px solid transparent; }
    .admin-sidebar .nav-link.active { border-right: none; border-bottom: 2px solid var(--accent-purple); }
    .admin-content { padding: 15px; }
    
    .container { padding: 0 16px; }
    
    /* Tables on mobile */
    .table-wrapper { overflow-x: auto; }
    table th, table td { white-space: nowrap; font-size: 0.85rem; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-purple); border-radius: 3px; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: none; align-items: center; justify-content: center;
    z-index: 9998;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }

/* ---- Pricing Cards (Premium Styles) ---- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}
@media (max-width: 991px) {
    .pricing-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}
.pricing-card {
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}
.pricing-card:hover {
    transform: translateY(-8px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}
.pricing-card.popular {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.04);
    box-shadow: 0 15px 35px rgba(124, 58, 237, 0.15), var(--shadow-glow);
}
.pricing-card.popular::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--gradient-primary);
}
.popular-badge {
    position: absolute;
    top: 15px;
    right: -35px;
    background: var(--gradient-primary);
    color: #fff;
    padding: 5px 35px;
    transform: rotate(45deg);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.pricing-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 10px rgba(255,255,255,0.05));
    transition: var(--transition);
}
.pricing-card:hover .pricing-icon {
    transform: scale(1.1);
}
.pricing-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.pricing-credits {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 40%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.pricing-price {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 20px;
}
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 35px 0;
    text-align: right;
    flex-grow: 1;
}
.pricing-features li {
    margin-bottom: 14px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.pricing-features li i {
    color: var(--accent-green);
    font-size: 1.05rem;
    flex-shrink: 0;
    margin-left: 8px;
}

