/* ========================================
   GS Telecom — Design System
   Cor Primária: #1C2BB9 (Azul Royal)
   Acento: #FF7A00 (Laranja) | #E60067 (Magenta)
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1C2BB9;
    --primary-dark: #1520a0;
    --primary-light: #3345cc;
    --primary-xlight: #e8ebff;
    --orange: #FF7A00;
    --orange-light: #fff3e8;
    --magenta: #E60067;
    --magenta-light: #ffe8f0;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0284c7;
    --info-light: #e0f2fe;
    --bg: #f0f2f8;
    --sidebar-bg: #0f1a6e;
    --sidebar-width: 240px;
    --card-bg: #fff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(28, 43, 185, 0.08);
    --shadow-md: 0 4px 24px rgba(28, 43, 185, 0.13);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* --- App Wrapper --- */
.app-wrapper { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.brand-gs {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #a8b4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-telecom {
    font-size: 11px;
    font-weight: 700;
    color: var(--orange);
    letter-spacing: 2px;
    text-transform: uppercase;
    -webkit-text-fill-color: var(--orange);
}

.brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.6);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

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

.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(28, 43, 185, 0.4);
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.4);
    font-size: 12px;
}

.dot-online {
    width: 8px; height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 28px 32px;
    min-width: 0;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 3px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(28,43,185,0.06);
    overflow: hidden;
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.card-body { padding: 22px; }
.card-body.p-0 { padding: 0; }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(28,43,185,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.wide { grid-column: span 2; }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.blue { background: var(--primary-xlight); color: var(--primary); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.magenta { background: var(--magenta-light); color: var(--magenta); }

.stat-info { display: flex; flex-direction: column; }

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* --- Content Row --- */
.content-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.flex-1 { flex: 1; min-width: 0; }
.w-340 { width: 340px; flex-shrink: 0; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(28,43,185,0.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px rgba(28,43,185,0.4); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-xlight); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-test {
    background: #f0f2ff;
    color: var(--primary);
    border: 1px solid #c7ceff;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s;
}
.btn-test svg { width: 15px; height: 15px; }
.btn-test:hover { background: var(--primary-xlight); border-color: var(--primary); }

.btn-link {
    font-size: 12.5px;
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: #f8f9ff;
    padding: 12px 16px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f3f8;
    vertical-align: middle;
    color: var(--text);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: #f8f9ff; }

.data-table tbody tr.row-urgente td { background: #fff8f0; }
.data-table tbody tr.row-urgente:hover td { background: #fff3e0; }

.phone-number {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    font-size: 13.5px;
    letter-spacing: 0.5px;
}

.iccid-code {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
}

.cell-name { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.action-buttons { display: flex; gap: 6px; }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #f1f3f4; color: #6b7280; }
.badge-primary { background: var(--primary-xlight); color: var(--primary); }

/* --- Filters --- */
.filters-card { margin-bottom: 16px; padding: 18px 22px; }
.filters-form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.filter-group label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; padding-bottom: 0; }

.table-meta { margin-bottom: 12px; }
.total-badge {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
    background: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* --- Forms --- */
.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(28,43,185,0.1);
}

.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 6px; position: relative; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-group.full { flex: 1 1 100%; }
.form-group.narrow { max-width: 140px; flex: 0 0 140px; }

.input-toggle-pass {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(2px);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    padding: 2px;
}

.field-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.form-actions { margin-top: 20px; }
.form-actions-main { margin-top: 24px; padding-top: 16px; }

/* --- Settings Sections --- */
.settings-section { margin-bottom: 20px; }

.test-integration-row {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.test-email-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
}

.test-result {
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.test-success { background: var(--success-light); color: var(--success); }
.test-error { background: var(--danger-light); color: var(--danger); }

/* --- Toggle Switch --- */
.toggle-card {
    background: var(--primary-xlight);
    border: 1.5px solid #c7ceff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.toggle-wrapper { display: flex; align-items: center; gap: 16px; }

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #c0c8d8;
    border-radius: 28px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px; height: 22px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }

.toggle-info strong { display: block; font-size: 14px; color: var(--text); }
.toggle-info small { color: var(--text-muted); font-size: 12px; }

/* --- Price Table --- */
.price-table .price-input-wrapper { display: flex; align-items: center; gap: 6px; max-width: 140px; }
.price-table .price-prefix { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.price-table .price-input { max-width: 110px; }
.margin-badge { 
    font-size: 12px; 
    font-weight: 700; 
    color: var(--success);
    background: var(--success-light);
    padding: 3px 8px;
    border-radius: 20px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: #fff;
    border: 1.5px solid var(--border);
    transition: all 0.2s;
    text-decoration: none;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- Sync Card --- */
.sync-phase { margin-bottom: 12px; font-size: 13.5px; color: var(--text); }
.sync-phase strong { color: var(--text-muted); }

.progress-wrapper { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }

.progress-bar-outer {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 8px;
    transition: width 0.5s ease;
}

.progress-bar-inner.animated {
    background: linear-gradient(90deg, var(--primary) 0%, #00cfff 50%, var(--primary) 100%);
    background-size: 200%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% center; }
    100% { background-position: 0% center; }
}

.progress-percent { font-size: 12px; font-weight: 700; color: var(--primary); width: 36px; text-align: right; }

.sync-details { border-top: 1px solid var(--border); padding-top: 12px; }

.sync-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.sync-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    background: #fff;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot.green { background: #22c55e; }
.dot.blue { background: var(--primary); animation: pulse 1.5s infinite; }
.dot.red { background: var(--danger); }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 26, 110, 0.4);
    backdrop-filter: blur(3px);
    z-index: 200;
}

.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 14px;
    width: min(90vw, 560px);
    max-height: 85vh;
    overflow-y: auto;
    z-index: 201;
    box-shadow: 0 20px 60px rgba(15,26,110,0.25);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, calc(-50% - 20px)); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.modal.hidden { display: none; }

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

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
    background: var(--border);
    border: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body { padding: 24px; }
.modal-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }

/* --- Detail Grid (inside modal) --- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-item.full { grid-column: span 2; }
.detail-item label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item span { font-size: 14px; font-weight: 500; color: var(--text); }

/* --- Toast --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 10px;
    padding: 14px 20px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    border-left: 4px solid var(--primary);
    font-size: 13.5px;
    font-weight: 500;
    min-width: 280px;
    animation: toastIn 0.3s ease;
    max-width: 400px;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }

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

/* --- Loading --- */
.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

.spinner-sm {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(28,43,185,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

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

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state.padded { padding: 50px; }
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* --- Alert --- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }

/* --- Utilities --- */
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.hidden { display: none !important; }

/* --- Sidebar User & Logout --- */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 16px;
    margin-top: auto;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.sidebar-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-email {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 12.5px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}
.sidebar-logout:hover {
    background: rgba(220,38,38,0.15);
    color: #f87171;
}
