/* Shamna Web IPTV Premium Style System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
    --bg-primary: #090a0f;
    --bg-secondary: #12141c;
    --bg-card: rgba(30, 34, 48, 0.4);
    --bg-card-hover: rgba(45, 51, 72, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.2);
    
    --text-primary: #ffffff;
    --text-secondary: #8b92b6;
    --accent: #2e6cf6;
    --accent-hover: #1e56d3;
    --accent-glow: rgba(46, 108, 246, 0.4);
    --success: #10b981;
    --danger: #ef4444;
    
    --font-en: 'Outfit', sans-serif;
    --font-ar: 'Cairo', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ar), var(--font-en);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.hidden {
    display: none !important;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-image: radial-gradient(circle at 10% 20%, rgba(18, 20, 28, 0.9) 0%, rgba(9, 10, 15, 1) 90%);
}

/* Glassmorphism utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

/* Login Page Styling */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #090a0f 0%, #171026 50%, #090a0f 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(46, 108, 246, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    z-index: 0;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    z-index: 0;
}

.login-card {
    width: 100%;
    max-width: 480px;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.6s ease-out;
}

.brand-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent) 0%, #9333ea 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--accent-glow);
}

.brand-logo img {
    width: 55%;
    height: auto;
}

.brand-name {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.brand-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 35px;
}

.form-group {
    margin-bottom: 20px;
    text-align: right;
    position: relative;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    padding-right: 5px;
}

.input-control {
    width: 100%;
    padding: 14px 16px;
    background: rgba(9, 10, 15, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
    text-align: left;
}

.input-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(46, 108, 246, 0.25);
    background: rgba(9, 10, 15, 0.8);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(46, 108, 246, 0.3);
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 108, 246, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-message {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

/* Dashboard Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.header-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo img {
    width: 55%;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
}

.header-nav {
    display: flex;
    gap: 10px;
}

.nav-item {
    padding: 10px 20px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.nav-item.active {
    border-bottom: 2px solid var(--accent);
    border-radius: 10px 10px 0 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--danger);
    color: var(--text-primary);
}

/* Home Screen Styling */
.home-screen {
    flex: 1;
    padding: 40px 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.welcome-section {
    margin-bottom: 40px;
    text-align: right;
}

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

.welcome-subtitle {
    color: var(--text-secondary);
}

.main-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.shortcut-card {
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.shortcut-card::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(255, 255, 255, 0.03) 100%);
}

.shortcut-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

.shortcut-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 30px;
}

.live-icon-bg {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.vod-icon-bg {
    background: rgba(46, 108, 246, 0.15);
    color: var(--accent);
    box-shadow: 0 0 20px rgba(46, 108, 246, 0.1);
}

.series-icon-bg {
    background: rgba(147, 51, 234, 0.15);
    color: #a855f7;
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.1);
}

.shortcut-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.shortcut-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.account-info-panel {
    border-radius: 20px;
    padding: 25px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: right;
}

.info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-val {
    font-size: 16px;
    font-weight: 700;
}

/* Category + Stream Master-Detail Screens */
.viewer-screen {
    display: flex;
    flex: 1;
    height: calc(100vh - 72px);
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.sidebar {
    width: 280px;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(9, 10, 15, 0.4);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.categories-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.category-item {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    border-right: 3px solid transparent;
    text-align: right;
    font-size: 14px;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.category-item.active {
    background: rgba(46, 108, 246, 0.1);
    color: var(--text-primary);
    border-right-color: var(--accent);
    font-weight: 700;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(9, 10, 15, 0.2);
}

.content-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-title {
    font-size: 20px;
    font-weight: 700;
}

/* Grid representation for VOD / Series */
.grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    align-content: start;
}

.media-card {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.media-poster-wrapper {
    width: 100%;
    aspect-ratio: 2/3;
    background: #161824;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.media-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.media-card:hover .media-poster {
    transform: scale(1.05);
}

.media-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    font-size: 28px;
    color: #fff;
}

.media-card:hover .media-play-overlay {
    opacity: 1;
}

.media-title {
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

/* Live TV Layout Specifics (Split Screen List & Video) */
.live-viewer {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.channels-list-pane {
    width: 320px;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(9, 10, 15, 0.2);
}

.channels-list {
    flex: 1;
    overflow-y: auto;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: var(--transition);
    text-align: right;
    flex-direction: row-reverse;
}

.channel-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.channel-item.active {
    background: rgba(46, 108, 246, 0.15);
    border-right: 3px solid var(--accent);
}

.channel-logo {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: contain;
    background: #1c1f2f;
    padding: 2px;
    flex-shrink: 0;
}

.channel-name-wrapper {
    flex: 1;
    overflow: hidden;
}

.channel-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-epg {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Player Pane */
.player-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
    justify-content: center;
}

.video-element {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
}

.no-video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 16px;
}

.no-video-placeholder i {
    font-size: 48px;
    color: var(--accent);
}

/* Details Modal for VOD / Series */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 850px;
    border-radius: 20px;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease-out;
}

.modal-header-image {
    height: 240px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.modal-header-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 100%);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 35px;
    height: 35px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--danger);
}

.modal-body {
    background: var(--bg-secondary);
    padding: 30px;
    overflow-y: auto;
    display: flex;
    gap: 30px;
}

.modal-poster {
    width: 180px;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    margin-top: -80px;
    z-index: 5;
    background: #111;
}

.modal-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: right;
}

.modal-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
}

.modal-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-direction: row-reverse;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 5px;
}

.modal-plot {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Season and Episodes Viewer for Series */
.series-seasons-container {
    width: 100%;
    margin-top: 20px;
}

.seasons-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    flex-direction: row-reverse;
}

.season-tab {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.season-tab:hover, .season-tab.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.season-tab.active {
    border: 1px solid var(--accent);
}

.episodes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
}

.episode-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    flex-direction: row-reverse;
}

.episode-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.episode-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-direction: row-reverse;
}

.episode-number {
    font-weight: 700;
    color: var(--accent);
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

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