/* ==========================================================================
   IPTV Manager Pro - Modern Design System (Glassmorphism & Rich Aesthetics)
   ========================================================================== */

:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(26, 35, 56, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.25);

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --emerald: #10b981;
    --emerald-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --purple: #a855f7;
    --purple-gradient: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-heading: #ffffff;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 15% 15%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 85% 85%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    line-height: 1.5;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.5px;
}

.logo-text h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Glassmorphism Cards */
.glassmorphism {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
}

.main-container {
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.card {
    padding: 1.5rem 1.8rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Input Section */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
}

.textarea-wrapper textarea {
    width: 100%;
    height: 180px;
    background: rgba(8, 12, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: #fff;
    font-family: monospace;
    font-size: 0.88rem;
    resize: none;
    outline: none;
    transition: var(--transition);
}

.textarea-wrapper textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.dropzone-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    padding: 1.8rem;
    text-align: center;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.03);
    transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary);
}

.drop-icon {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.dropzone p {
    font-size: 0.95rem;
    color: var(--text-main);
}

.dropzone span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.action-buttons-row {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    flex: 1;
}

.btn-gradient-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-gradient-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-emerald {
    background: var(--emerald-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-emerald:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-purple {
    background: var(--purple-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-purple:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* Progress Bar */
.progress-container {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    border-radius: 99px;
}

/* KPIs Dashboard */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.kpi-card {
    padding: 1.2rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}

.icon-blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.icon-green { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.icon-spanish { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.icon-orange { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.icon-purple { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.kpi-data .kpi-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-data h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-heading);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card h3 {
    font-size: 1.05rem;
    color: var(--text-heading);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    position: relative;
    height: 260px;
}

/* Table Toolbar */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.search-box input {
    background: rgba(8, 12, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.8rem 0.55rem 2.2rem;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    width: 260px;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    width: 300px;
}

.select-input {
    background: rgba(8, 12, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.8rem;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.custom-table th {
    background: rgba(15, 23, 42, 0.8);
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.custom-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.custom-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.custom-table tr.inactive-row {
    background: rgba(239, 68, 68, 0.04);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-lang { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

.badge-new { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; border: 1px solid #10b981; }
.badge-updated { background: rgba(59, 130, 246, 0.25); color: #93c5fd; border: 1px solid #3b82f6; }
.badge-saved { background: rgba(156, 163, 175, 0.2); color: #d1d5db; border: 1px solid rgba(255,255,255,0.1); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    opacity: 0.5;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-container {
    width: 92%;
    max-width: 1100px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-glow);
    overflow: hidden;
}

.modal-summary {
    max-width: 650px;
}

.summary-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.summary-subtitle {
    font-size: 0.92rem;
    color: var(--text-main);
}

.text-emerald { color: var(--emerald); }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
}

.summary-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.summary-card .sum-title {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.4rem;
}

.summary-card h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.card-emerald { border-color: rgba(16, 185, 129, 0.4); }
.card-emerald h3 { color: #34d399; }
.card-blue { border-color: rgba(59, 130, 246, 0.4); }
.card-blue h3 { color: #60a5fa; }
.card-green { border-color: rgba(16, 185, 129, 0.4); }
.card-green h3 { color: #34d399; }
.card-red { border-color: rgba(239, 68, 68, 0.4); }
.card-red h3 { color: #f87171; }

.summary-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.modal-player {
    max-width: 850px;
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--text-heading);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover { color: #fff; }

/* Category Sidebar Layout in Modal */
.modal-explorer-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(88vh - 70px);
}

.explorer-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.explorer-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}

@media (max-width: 768px) {
    .explorer-layout {
        grid-template-columns: 1fr;
    }
}

.categories-sidebar {
    background: rgba(8, 12, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-heading);
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.7);
}

.category-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 0.4rem;
}

.cat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
}

.cat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.cat-item.active {
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 600;
}

.cat-count {
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.15rem 0.45rem;
    border-radius: 99px;
}

.channels-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.85rem;
    overflow-y: auto;
    padding-right: 0.4rem;
    flex: 1;
}

.channel-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.channel-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}

.channel-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    background: #000;
    flex-shrink: 0;
}

.channel-info {
    overflow: hidden;
}

.channel-info h4 {
    font-size: 0.84rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Video Player */
.video-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.video-container video {
    width: 100%;
    height: 100%;
}

.player-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

.player-info code {
    color: var(--emerald);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.hidden {
    display: none !important;
}
