/* Teamarr - Dynamic EPG Generator for Sports Channels */

:root {
    /* Dark mode colors (default) */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Accent colors */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #06b6d4;

    /* Borders */
    --border: #334155;
    --border-light: #475569;
}

/* Light theme override */
.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --border-light: #94a3b8;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Utility classes */
.text-center {
    text-align: center !important;
}

/* Navbar - Compact */
.navbar {
    background: var(--bg-secondary);
    color: white;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border);
}

.navbar .nav-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand .brand-logo-link {
    display: flex;
    align-items: center;
}

.nav-brand .brand-logo {
    height: 44px;
    width: auto;
}

.nav-brand .brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-brand .brand-link {
    text-decoration: none;
}

.nav-brand h1 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.nav-brand .tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-end;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 1rem;
    font-weight: 500;
}

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

/* Main Content - Compact */
main {
    padding: 1rem 0;
    min-height: calc(100vh - 150px);
}

/* Cards - Compact */
.card {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Buttons - Compact */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.5;
}

/* Ensure button elements match anchor styling */
button.btn {
    font-family: inherit;
    box-sizing: border-box;
}

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

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

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

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

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

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

/* Version Badge */
.version-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-weight: 500;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--border-light);
    transform: scale(1.05);
}

/* Forms - Compact */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.form-group input[readonly] {
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
    font-family: 'Monaco', 'Courier New', monospace;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.help-text {
    display: block;
    margin-top: 0.2rem;
    margin-bottom: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

fieldset {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

fieldset legend {
    padding: 0 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.section-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: -0.5rem 0 1rem 0;
}

/* Tables - Compact */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table th,
.table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    color: var(--text-secondary);
}

.table tr:hover {
    background: var(--bg-tertiary);
}

.table-actions a,
.table-actions button {
    margin-right: 0.4rem;
}

.table-actions a:last-child,
.table-actions button:last-child {
    margin-right: 0;
}

.table-actions form {
    display: inline;
    margin: 0;
}

.table-actions .btn {
    margin: 0;
    margin-right: 0.4rem;
}

.table td .badge,
.table td code {
    vertical-align: middle;
}

/* Status Badges - Compact */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* Stats Grid - Compact */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Variable Helper - Compact */
.variable-helper {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.variable-helper h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.variable-search {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.variable-category {
    margin-bottom: 0.75rem;
}

.variable-category h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variable-collapsible {
    margin-bottom: 0.5rem;
}

.variable-collapsible summary {
    cursor: pointer;
    font-weight: 600;
    margin: 0.5rem 0 0.4rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    user-select: none;
}

.variable-collapsible summary:hover {
    color: var(--primary);
}

.variable-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0;
}

.chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Preview Box - Compact */
.preview {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
}

.preview strong {
    color: var(--warning);
}

/* Alerts - Compact */
.alert {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-left: 3px solid var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-left: 3px solid var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border-left: 3px solid var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-left: 3px solid var(--primary);
}

/* Footer - Compact */
footer {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

footer .footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

footer .footer-logo {
    height: 24px;
    width: auto;
    opacity: 0.7;
}

footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .table-actions {
        flex-direction: column;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    animation: spin 1s linear infinite;
    margin: 1.5rem auto;
}

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

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

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* Notification System - Floating Popups */
#notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
    position: relative;
    width: 400px;
}

.notification.notification-success {
    border-left: 4px solid var(--success);
}

.notification.notification-error {
    border-left: 4px solid var(--danger);
}

.notification.notification-info {
    border-left: 4px solid var(--info);
}

.notification.notification-warning {
    border-left: 4px solid var(--warning);
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.notification-message {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.notification-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notification.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Field-level Copy Button */
.btn-copy-field {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-copy-field:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.field-copy-menu {
    position: relative;
    display: inline-block;
}

.field-copy-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5rem;
}

.field-copy-dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.field-copy-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.field-copy-dropdown-item:last-child {
    border-bottom: none;
}

.field-copy-dropdown-header {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

/* ============================================================================
   SUFFIX GUIDANCE UI
   ============================================================================ */

/* Suffix Guide */
.suffix-guide {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.suffix-guide-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
}

.suffix-guide-list li {
    padding: 0.15rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.suffix-guide-list code {
    font-family: 'Monaco', 'Courier New', monospace;
    background: var(--bg-primary);
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.7rem;
}

.suffix-legend {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Suffix badge for legend */
.suffix-badge {
    display: inline-block;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-all {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.badge-base {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.badge-next {
    background: rgba(34, 197, 94, 0.2);
    color: #6ee7b7;
}

.badge-last {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Light mode badge overrides */
.light-theme .badge-all {
    background: rgba(59, 130, 246, 0.2);
    color: #2563eb;
    border: 1px solid #3b82f6;
}

.light-theme .badge-base {
    background: rgba(156, 163, 175, 0.25);
    color: #4b5563;
    border: 1px solid #9ca3af;
}

.light-theme .badge-next {
    background: rgba(34, 197, 94, 0.2);
    color: #059669;
    border: 1px solid #10b981;
}

.light-theme .badge-last {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
    border: 1px solid #ef4444;
}

/* Variable color classes for chips */
.chip.var-all {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.chip.var-all:hover {
    background: rgba(59, 130, 246, 0.3);
    color: white;
    border-color: var(--primary);
}

.chip.var-base {
    background: rgba(156, 163, 175, 0.15);
    border-color: rgba(156, 163, 175, 0.3);
    color: #9ca3af;
}

.chip.var-base:hover {
    background: rgba(156, 163, 175, 0.3);
    color: white;
    border-color: #9ca3af;
}

.chip.var-next {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #6ee7b7;
}

.chip.var-next:hover {
    background: rgba(34, 197, 94, 0.3);
    color: white;
    border-color: var(--success);
}

.chip.var-last {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.chip.var-last:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
    border-color: var(--danger);
}

/* Light mode overrides */
.light-theme .chip.var-all {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.light-theme .chip.var-base {
    background: rgba(156, 163, 175, 0.15);
    color: #4b5563;
}

.light-theme .chip.var-next {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
}

.light-theme .chip.var-last {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

