/* ============================================================
   SMS SENDER PRO — Premium Dark UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-base: #060912;
    --bg-surface: #0d1117;
    --bg-card: #111827;
    --bg-card-hover: #161f2e;
    --bg-input: #0a0f1a;
    --border: rgba(255,255,255,0.07);
    --border-focus: rgba(99,102,241,0.6);

    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-glow: rgba(99,102,241,0.25);
    --primary-hover: #4f46e5;
    
    --success: #10b981;
    --success-glow: rgba(16,185,129,0.2);
    --error: #ef4444;
    --error-glow: rgba(239,68,68,0.2);
    --warning: #f59e0b;
    --warning-glow: rgba(245,158,11,0.2);

    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(ellipse 80% 60% at 20% -10%, rgba(99,102,241,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(16,185,129,0.07) 0%, transparent 60%);
    background-attachment: fixed;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============ NAVBAR ============ */
.navbar {
    background: rgba(13,17,23,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--primary-glow);
}

.navbar-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary-glow), rgba(139,92,246,0.2));
    border: 1px solid rgba(99,102,241,0.3);
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============ STATUS BANNER ============ */
.status-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin: auto 0 0 0; /* Pushes to bottom of sidebar */
    width: 100%;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.status-banner.online {
    border-color: rgba(16,185,129,0.35);
    background: rgba(16,185,129,0.06);
    box-shadow: 0 0 30px rgba(16,185,129,0.1);
}

.status-banner.offline {
    border-color: rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.06);
    box-shadow: 0 0 30px rgba(239,68,68,0.1);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    margin-top: 4px;
}

.status-banner.online .status-indicator {
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulseOnline 2s infinite;
}

.status-banner.offline .status-indicator {
    background: var(--error);
    box-shadow: 0 0 12px var(--error);
    animation: pulseOffline 1.2s infinite;
}

@keyframes pulseOnline {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

@keyframes pulseOffline {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.status-text { display: flex; flex-direction: column; }

.status-text span:first-child {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-main);
    line-height: 1.3;
}

.status-details { font-size: 0.7rem; color: var(--text-secondary); line-height: 1.2; margin-top: 2px; }

/* ============ LAYOUT ============ */
.app-wrapper {
    display: flex;
    min-height: calc(100vh - 64px);
    width: 100%;
}

/* ============ SIDE MENU ============ */
.side-menu {
    width: 250px;
    background: rgba(13,17,23,0.6);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.menu-item.active {
    background: var(--primary-glow);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.menu-icon {
    font-size: 1.2rem;
}

.tab-content {
    display: none;
    flex: 1;
}

.tab-content.active-tab {
    display: grid;
}
.layout-container {
    max-width: 1150px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(380px, 1fr);
    grid-template-rows: auto;
    gap: 2rem;
    align-items: start;
    flex: 1;
}

main, #smsForm { display: flex; flex-direction: column; gap: 1.5rem; }

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 90px;
}

@media (max-width: 1080px) {
    .layout-container { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.card-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.02);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-title-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.icon-server { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.icon-msg { background: rgba(16,185,129,0.15); color: var(--success); }
.icon-target { background: rgba(245,158,11,0.15); color: var(--warning); }
.icon-log { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.icon-inbox { background: rgba(16,185,129,0.15); color: var(--success); }

.card-body { padding: 1.75rem; }

/* ============ SECTION STEP NUMBER ============ */
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* ============ FORM ELEMENTS ============ */
.form-group { margin-bottom: 1.25rem; }
.form-group:last-child { margin-bottom: 0; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

label .label-optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: 4px;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-main);
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select option { background: #1e293b; color: var(--text-main); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(99,102,241,0.04);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 90px; }

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.5;
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    border-left: 2px solid rgba(99,102,241,0.4);
}

.hint strong { color: var(--primary-light); font-weight: 600; }

/* ============ SLIDER ============ */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 99px;
    outline: none;
    border: none;
    padding: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 99px;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--value, 0%), rgba(255,255,255,0.1) var(--value, 0%));
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 0 0 3px var(--primary-glow), 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

.delay-value-badge {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.25);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 84px;
    text-align: center;
    color: var(--primary-light);
}

.help-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ============ BUTTONS ============ */
.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
}

.btn:hover::after { background: rgba(255,255,255,0.06); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(99,102,241,0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: rgba(239,68,68,0.1);
    color: var(--error);
    border: 1px solid rgba(239,68,68,0.25);
}

.btn-danger:hover {
    background: rgba(239,68,68,0.18);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.btn-auto {
    flex: none;
    width: auto;
}

.btn-sm {
    flex: none;
    padding: 0.4rem 0.85rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* ============ DAISYUI INSPIRED STATS ============ */
.stats-row {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.stat-box {
    flex: 1;
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--border);
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.stat-box:last-child {
    border-right: none;
}

.stat-box:hover {
    background: rgba(255,255,255,0.02);
}

.stat-figure {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 1.5rem;
    opacity: 0.8;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: auto; /* Pushes everything else to the bottom */
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 0.2rem;
    margin-top: 1rem; /* Ensures space above the number if the text is short */
}

.stat-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
    height: 32px; /* Force exact height so 1 or 2 lines take the same space */
}

.stat-value.total { color: var(--text-main); }
.stat-value.success { color: var(--success); }
.stat-value.error { color: var(--error); }

/* ============ LOG CONTAINER ============ */
.log-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    height: 380px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scroll-behavior: smooth;
}

.log-placeholder {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
    font-style: italic;
    margin: auto;
}

.log-item {
    font-size: 0.8rem;
    padding: 0.65rem 0.875rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    animation: slideIn 0.2s ease-out;
    transition: var(--transition);
}

.log-item:hover { background: rgba(255,255,255,0.05); }

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

.log-msg { color: var(--text-main); flex: 1; line-height: 1.4; word-break: break-word; }
.log-item.processing { border-left-color: var(--primary); background: rgba(99,102,241,0.08); }
.log-item.success { border-left-color: var(--success); background: rgba(16,185,129,0.08); }
.log-item.error { border-left-color: var(--error); background: rgba(239,68,68,0.08); }
.log-item.warning { border-left-color: var(--warning); background: rgba(245,158,11,0.08); }
.log-item.default { border-left-color: var(--text-muted); background: rgba(255,255,255,0.03); }

/* ============ FILTER KONTAK SPECIFIC STYLES ============ */

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

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

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 34px;
    transition: .4s;
    flex: none;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* ============ HISTORY TABLE ============ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

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

.history-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    background: rgba(0,0,0,0.15);
}

.history-table tbody tr {
    transition: background 0.2s;
}

.history-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

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

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

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

/* Grid & Cards for Filter Results */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.provider-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.provider-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -10px rgba(0,0,0,0.5);
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.provider-name {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.count-badge {
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-copy { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.btn-copy:hover { background: rgba(59, 130, 246, 0.4); }
.btn-dl { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.btn-dl:hover { background: rgba(16, 185, 129, 0.4); }

/* Provider Theme Colors */
.theme-tsel { border-top: 4px solid #ef4444; }
.theme-tsel .provider-name { color: #ef4444; }
.theme-isat { border-top: 4px solid #eab308; }
.theme-isat .provider-name { color: #eab308; }
.theme-xl { border-top: 4px solid #3b82f6; }
.theme-xl .provider-name { color: #3b82f6; }
.theme-axis { border-top: 4px solid #a855f7; }
.theme-axis .provider-name { color: #a855f7; }
.theme-tri { border-top: 4px solid #10b981; }
.theme-tri .provider-name { color: #10b981; }
.theme-smart { border-top: 4px solid #ec4899; }
.theme-smart .provider-name { color: #ec4899; }
.theme-other { border-top: 4px solid #94a3b8; }
.theme-other .provider-name { color: #94a3b8; }

.log-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.2rem;
    font-variant-numeric: tabular-nums;
}

.log-msg { word-break: break-word; color: var(--text-main); line-height: 1.4; }

/* ============ INBOX ============ */
.inbox-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    height: 280px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ============ DIVIDER ============ */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 1.25rem 0;
}

/* ============ PROGRESS BAR (inside send btn) ============ */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.btn-loading {
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #4f46e5);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ============ TOOLTIP CHIP ============ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.25);
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .layout-container { padding: 1rem; gap: 1rem; }
    .card-body { padding: 1.25rem; }
    .navbar { padding: 0 1.25rem; }
}
