/* SUM TV - Mobile First CSS with Purple Theme */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Color Variables */
:root {
    --primary-color: #1976d2;
    --primary-light: #2196f3;
    --primary-dark: #0d47a1;
    --secondary-color: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --background-light: #fafafa;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Dark mode variables */
    --dark-bg-primary: #121212;
    --dark-bg-secondary: #1e1e1e;
    --dark-bg-tertiary: #2a2a2a;
    --dark-text-primary: #ffffff;
    --dark-text-secondary: #cccccc;
    --dark-text-muted: #999999;
    --dark-border: #333333;
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%),
                url('../app-image.php?type=splash') center/cover;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.splash-screen.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeInScale 1s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: rotateLogo 2s ease-in-out infinite;
}

.splash-logo img {
    animation: rotateImage 3s linear infinite;
}

.splash-text {
    color: white;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    animation: fadeInUp 1s ease-out 0.5s both;
}

/* Logo rotation animations */
@keyframes rotateLogo {
    0% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    }
    25% {
        transform: scale(1.05) rotate(90deg);
        box-shadow: 0 12px 40px rgba(25,118,210,0.4);
    }
    50% {
        transform: scale(1.1) rotate(180deg);
        box-shadow: 0 16px 48px rgba(25,118,210,0.5);
    }
    75% {
        transform: scale(1.05) rotate(270deg);
        box-shadow: 0 12px 40px rgba(25,118,210,0.4);
    }
    100% {
        transform: scale(1) rotate(360deg);
        box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    }
}

@keyframes rotateImage {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.social-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.social-icon:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* Main App Container */
.app-container {
    min-height: 100vh;
    background-color: var(--background-light);
    background-image: url('../app-image.php?type=background');
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 0;
}

/* Top App Bar */
.top-bar {
    background: var(--primary-color);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--card-shadow);
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.page-title {
    font-size: 18px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.action-icon {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.action-icon:hover {
    background: rgba(255,255,255,0.1);
}

/* Sidebar Drawer */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    border-radius: 0 20px 20px 0;
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
    transition: var(--transition);
    z-index: 2000;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    background: white;
    color: var(--primary-color);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    text-align: center;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.sidebar-close:hover {
    background: rgba(25, 118, 210, 0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.sidebar-link:hover {
    background: rgba(25, 118, 210, 0.05);
}

.sidebar-link i {
    margin-right: 16px;
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-link-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
}

.sidebar-link-arrow {
    margin-left: auto;
    font-size: 14px;
    opacity: 0.7;
}

.sidebar-section-title {
    padding: 16px 20px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    flex: 1;
    padding-bottom: 70px;
    overflow-y: auto;
    display: block;
    position: relative;
    z-index: 1;
}

/* Content Sections */
.content-section {
    padding: 20px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.section-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding: 0 4px;
}

/* Video Cards */
.video-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #f0f0f0;
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: var(--transition);
}

.video-card:hover .play-overlay {
    background: var(--primary-color);
}

.video-info {
    padding: 16px;
}

.video-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.video-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.progress-bar {
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: #ff0000;
    width: 0%;
    transition: width 0.3s ease;
}

/* Grid Layout for YouTube Page */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 16px;
}

.video-grid .video-card {
    margin-bottom: 0;
}

.video-grid .video-title {
    font-size: 14px;
    line-height: 1.3;
}

/* Live TV and Radio Pages */
.stream-container {
    padding: 20px;
}

.stream-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.stream-player {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 16px;
}

.stream-message {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
}

.stream-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.stream-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.stream-btn:hover {
    background: var(--primary-dark);
}

.stream-btn.secondary {
    background: #e0e0e0;
    color: var(--text-primary);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
}

.nav-items {
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    min-width: 60px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

/* About Page */
.about-content {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.about-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.about-title {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
}

.about-text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.about-social {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
}

.modal-body {
    padding: 20px;
}

/* Responsive Design */
@media (min-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .content-section {
        padding: 32px;
    }
    
    .about-content {
        padding: 32px;
    }
}

@media (min-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .stream-container {
        max-width: 800px;
        margin: 0 auto;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark Theme */
body.dark-theme {
    background-color: var(--dark-bg-primary);
    color: var(--dark-text-primary);
}

body.dark-theme .app-container {
    background-color: var(--dark-bg-primary);
}

body.dark-theme .top-bar {
    background-color: var(--dark-bg-secondary);
}

body.dark-theme .sidebar {
    background-color: var(--dark-bg-secondary);
}

body.dark-theme .sidebar-header {
    background-color: var(--dark-bg-secondary);
    border-bottom-color: var(--dark-border);
}

body.dark-theme .sidebar-item {
    border-bottom-color: var(--dark-border);
}

body.dark-theme .sidebar-link {
    color: var(--dark-text-primary);
}

body.dark-theme .sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .sidebar-section-title {
    color: var(--dark-text-muted);
}

body.dark-theme .main-content {
    background-color: var(--dark-bg-primary);
}

body.dark-theme .content-section {
    background-color: var(--dark-bg-primary);
}

body.dark-theme .video-card {
    background-color: var(--dark-bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-theme .video-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

body.dark-theme .video-title {
    color: var(--dark-text-primary);
}

body.dark-theme .video-meta {
    color: var(--dark-text-muted);
}

body.dark-theme .section-title {
    color: var(--dark-text-primary);
}

body.dark-theme .stream-card {
    background-color: var(--dark-bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-theme .about-card {
    background-color: var(--dark-bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-theme .about-title {
    color: var(--dark-text-primary);
}

body.dark-theme .about-text {
    color: var(--dark-text-secondary);
}

body.dark-theme .bottom-nav {
    background-color: var(--dark-bg-secondary);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.3);
}

body.dark-theme .nav-item {
    color: var(--dark-text-muted);
}

body.dark-theme .nav-item.active {
    color: var(--primary-color);
}

body.dark-theme .nav-item:hover {
    color: var(--primary-color);
}

body.dark-theme .modal-content {
    background-color: var(--dark-bg-secondary);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

body.dark-theme .form-input {
    background-color: var(--dark-bg-tertiary);
    border-color: var(--dark-border);
    color: var(--dark-text-primary);
}

body.dark-theme .form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.2);
}

body.dark-theme .loading {
    color: var(--dark-text-secondary);
}

body.dark-theme .loading-spinner {
    border-color: var(--dark-border);
    border-top-color: var(--primary-color);
}

body.dark-theme .progress-bar {
    background-color: var(--dark-border);
}

body.dark-theme .stream-btn {
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

body.dark-theme .stream-btn.secondary {
    background-color: var(--dark-bg-tertiary);
    color: var(--dark-text-primary);
}

body.dark-theme .stream-message {
    color: var(--dark-text-secondary);
}

body.dark-theme .stream-controls {
    gap: 16px;
}

body.dark-theme .modal-close {
    background: rgba(255,255,255,0.1);
}

body.dark-theme .modal-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Video Player Dark Theme */
.video-player-container {
    background-color: #000000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.video-player-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 10;
}

.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.video-details {
    padding: 16px;
    background-color: #1e1e1e;
    border-radius: 0 0 12px 12px;
}

.video-details h3 {
    color: white;
    margin: 0 0 8px 0;
    font-size: 18px;
}

.video-details .meta {
    color: #999999;
    font-size: 14px;
}

/* Related Videos Section */
.related-videos {
    margin-top: 20px;
}

.related-videos h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 500;
}

.related-video-item {
    display: flex;
    background-color: #1e1e1e;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.related-video-item:hover {
    background-color: #2a2a2a;
}

.related-video-item.active {
    border: 2px solid var(--primary-color);
}

.related-video-thumbnail {
    width: 120px;
    height: 68px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.related-video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.related-video-title {
    color: white;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.3;
}

.related-video-meta {
    color: #999999;
    font-size: 12px;
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.p-2 { padding: 16px; }
