/* =============================================
   IPTV Lines Manager - Styles
   Design moderno, escuro e responsivo
   ============================================= */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

textarea { resize: vertical; min-height: 100px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-block { width: 100%; }

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

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

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

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

.btn-info { background: #0ea5e9; color: white; }
.btn-info:hover { background: #0284c7; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }

/* Navbar */
.navbar {
    background: var(--bg-card);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand i { margin-right: 10px; }

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

.nav-user span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(59,130,246,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary);
}

.stat-success .stat-icon { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-danger .stat-icon { background: rgba(239,68,68,0.15); color: var(--danger); }

.stat-number { display: block; font-size: 28px; font-weight: 700; }
.stat-label { color: var(--text-secondary); font-size: 13px; }

/* Search Box */
.search-box {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

.search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input-wrap {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input-wrap input {
    padding-left: 45px;
}

/* Table */
.table-container {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--bg-input);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.table th a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table th a:hover { color: var(--primary); }

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover { background: rgba(59,130,246,0.05); }

.row-expired {
    opacity: 0.6;
    background: rgba(239,68,68,0.05);
}

.link-painel {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.link-painel:hover { text-decoration: underline; }

code {
    background: var(--bg-dark);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
}

.expira-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.expira-info small { color: var(--text-secondary); font-size: 12px; }

.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-center { text-align: center !important; }

.livelist-cell { max-width: 300px; }

.livelist-preview {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.livelist-preview:hover { color: var(--primary); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlide 0.3s ease;
}

.modal-content.modal-large {
    max-width: 95%;
    width: 1200px;
}

.detail-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section h4 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.copyable {
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.copyable:hover {
    background: rgba(59,130,246,0.1);
}

.copy-icon {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.5;
}

.copyable:hover .copy-icon {
    opacity: 1;
    color: var(--primary);
}

.m3u-box {
    background: var(--bg-dark);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
    max-height: 100px;
    overflow-y: auto;
}

.categories-box {
    background: var(--bg-dark);
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 2;
    max-height: 200px;
    overflow-y: auto;
}

.star {
    color: #fbbf24;
}

.no-data {
    color: var(--text-secondary);
    font-style: italic;
}

.actions-cell {
    white-space: nowrap;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes modalSlide {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 8px;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.detail-item {
    background: var(--bg-dark);
    padding: 16px;
    border-radius: 8px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.detail-item .value {
    font-size: 14px;
    word-break: break-all;
}

.detail-full { grid-column: 1 / -1; }

.categories-box {
    background: var(--bg-dark);
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
}

.categories-box h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--primary);
}

.categories-content {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.copy-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
}

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

/* Admin Specific */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-nav {
    background: var(--bg-card);
    padding: 15px 30px;
    margin-bottom: 30px;
    border-radius: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--primary);
    color: white;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .nav-user {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .container { padding: 15px; }
    
    .stats-grid { grid-template-columns: 1fr; }
    
    .table-container { overflow-x: auto; }
    
    .table { min-width: 600px; }
    
    .search-form { flex-direction: column; }
    
    .search-input-wrap { min-width: 100%; }
    
    .modal-content { max-height: 95vh; }
    
    .detail-grid { grid-template-columns: 1fr; }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlide 0.3s ease;
    z-index: 2000;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
/* Modal Large */
.modal-content.modal-large {
    max-width: 95%;
    width: 1100px;
}

.detail-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h4 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 15px;
}

.detail-full {
    grid-column: 1 / -1;
}

.value-box {
    background: var(--bg-dark);
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    word-break: break-all;
}

.copy-btn {
    background: var(--bg-input);
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

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

.m3u-box {
    font-family: monospace;
    font-size: 12px;
    max-height: 80px;
    overflow-y: auto;
}

.categories-box {
    background: var(--bg-dark);
    padding: 14px;
    border-radius: 6px;
    max-height: 180px;
    overflow-y: auto;
    line-height: 1.8;
    font-size: 13px;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 9999;
}

.actions-cell {
    white-space: nowrap;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}
.page-header h1 {
    font-size: 22px;
    flex: 1;
}
.badge-count {
    background: var(--primary);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Paineis Grid */
.paineis-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.painel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}
.painel-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}
.painel-icon {
    width: 50px;
    height: 50px;
    background: rgba(59,130,246,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary);
}
.painel-info {
    flex: 1;
}
.painel-info h3 {
    font-size: 16px;
    margin-bottom: 6px;
}
.painel-stats {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}
.painel-stats .good { color: var(--success); }
.painel-stats .bad { color: var(--danger); }
.painel-card > i { color: var(--text-secondary); }

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.line-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.line-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.line-card.expired {
    opacity: 0.6;
    border-color: var(--danger);
}
.line-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.line-card-header code {
    font-size: 13px;
}
.badge-exp {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-exp.good { background: rgba(16,185,129,0.2); color: var(--success); }
.badge-exp.bad { background: rgba(239,68,68,0.2); color: var(--danger); }
.line-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.line-card-body i { width: 18px; }
.line-card-actions {
    display: flex;
    justify-content: flex-end;
}
.btn-action {
    background: var(--bg-input);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
}
.btn-action:hover {
    background: var(--primary);
    color: white;
}

/* Mobile */
@media (max-width: 600px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .nav-user .btn span { display: none; }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    background: var(--bg-card);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
}
.tab:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}
.tab.active {
    background: var(--primary);
    color: white;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.section-header h2 {
    flex: 1;
    font-size: 20px;
}

/* Stat Info */
.stat-card.stat-info .stat-icon {
    background: rgba(14,165,233,0.15);
    color: #0ea5e9;
}

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .tab span { display: none; }
    .user-name { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
