@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0a0f1d;
    --primary-hover: #162032;
    --primary-gradient: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --bg-app: #050811;
    --bg-sidebar: #0a0f1d;
    --bg-panel: #0a0f1d;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-hover: #00d2ff;
    --sidebar-active-bg: rgba(0, 210, 255, 0.1);
    --sidebar-active-text: #00d2ff;
    --border-color: rgba(255,255,255,0.05);
    
    --neon-blue: #00d2ff;
    --neon-purple: #7000ff;
    --neon-glow: 0 0 10px rgba(0, 210, 255, 0.5), 0 0 20px rgba(0, 210, 255, 0.3);
    
    --success: #00e676;
    --warning: #ffea00;
    --danger: #ff1744;
    --info: #00d2ff;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03);
    
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 10;
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-header h2 span {
    color: var(--sidebar-active-text);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
}

.nav-item i {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-item:hover {
    background-color: #f8fafc;
    color: var(--text-sidebar-hover);
    padding-left: 28px;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left: 4px solid var(--sidebar-active-text);
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 16px 28px;
}

.checker-nav {
    color: #fbbf24;
}

.sidebar-footer {
    padding: 24px 28px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.1);
}

/* === Premium Topbar Profile === */
.topbar-divider {
    width: 1px;
    height: 32px;
    background-color: var(--border-color);
    margin: 0 10px;
}

.user-profile-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px 6px 6px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.user-profile-wrapper:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.user-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.user-details .username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-details .role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--neon-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.btn-logout-icon:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.topbar {
    height: 80px;
    background-color: rgba(10, 15, 29, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 5;
}

.topbar-title h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.status-badge .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5);
}

.status-badge.disconnected .dot { background-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.status-badge.connected .dot { background-color: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
    color: var(--neon-blue);
    border-color: rgba(0,210,255,0.3);
}

/* Views Container */
.views-container {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.view-section {
    display: none;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active {
    display: block;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* Dashboard Tabs & Bento Layout */
.dash-tabs-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.dash-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.dash-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dash-tab-btn.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0,210,255,0.2);
    border: 1px solid rgba(0, 210, 255, 0.3);
}

.dash-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.dash-panel.active {
    display: block;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.bento-chart {
    height: 100%;
}

.bento-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

@media (max-width: 1000px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
}

/* Device Grid (Dynamic) */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.device-card {
    background: rgba(10, 15, 29, 0.6);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
    position: relative;
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.device-card-header.waba-card {
    border-bottom: 1px dashed #10b981;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.device-card-header.waba-card .device-name {
    color: var(--success);
}

.device-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-options-btn {
    background: rgba(0, 210, 255, 0.1);
    color: var(--neon-blue);
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-weight: bold;
}

.device-phone {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.device-phone span {
    color: var(--text-main);
    font-weight: 500;
}

.device-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.device-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.device-status-badge.connected {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}
.device-status-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.device-card.disconnected {
    border-left: 4px solid var(--danger);
}

/* Charts Section (Legacy/Fallback) */
.dashboard-charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(16px);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.chart-card h3 {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 20px;
}

.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

@media (max-width: 900px) {
    .dashboard-charts-container {
        grid-template-columns: 1fr;
    }
}

.metric-card {
    background: linear-gradient(145deg, rgba(20,25,40,0.95), rgba(10,15,30,0.9));
    backdrop-filter: blur(12px);
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 210, 255, 0.1);
    border-color: var(--neon-blue);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 5px;
    background: var(--primary-gradient);
    opacity: 0.8;
    transition: height 0.3s ease;
}
.metric-card:hover::before {
    height: 8px;
}

.metric-card h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.metric-card .sub-value {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-card .trend {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.trend.positive { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.trend.negative { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.trend.neutral { color: var(--text-muted); }

/* Containers */
.dashboard-widgets, .checker-container, .broadcast-container {
    background: var(--bg-panel);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.broadcast-container h2, .checker-container h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}
.broadcast-container p, .checker-container p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

textarea, input[type="text"], input[type="url"], input[type="datetime-local"], select.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    background-color: rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    color: var(--text-main);
}

textarea:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="datetime-local"]:focus, select.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(0,0,0,0.4);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Omnichannel Chat Panel */
.live-chat-panel {
    height: calc(100vh - 180px); /* 100vh minus topbar and padding */
    min-height: 500px;
    background-color: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(10, 15, 29, 0.8);
}

.chat-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.chat-tabs {
    background: rgba(0,0,0,0.2);
    padding: 4px;
    border-radius: 8px;
    display: inline-flex;
    border: 1px solid rgba(255,255,255,0.05);
}

.chat-tabs .tab {
    background: transparent;
    border: none;
    padding: 6px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.chat-tabs .tab.active {
    background-color: rgba(0, 210, 255, 0.1);
    color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0,210,255,0.2);
    border: 1px solid rgba(0,210,255,0.3);
}

.chat-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.chat-sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background-color: rgba(10, 15, 29, 0.6);
}

.contact-list {
    list-style: none;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.contact-item:hover {
    background-color: rgba(255,255,255,0.05);
}

.contact-item.active {
    background-color: rgba(0, 210, 255, 0.1);
    border-left: 3px solid var(--neon-blue);
}

.contact-item .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.contact-item .info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.contact-item .info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 160px;
}

.chat-room {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #050811; 
    background-image: none;
}

.room-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-bottom: 6px;
    display: block;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message.system {
    align-self: center;
    background-color: rgba(0,0,0,0.3);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 20px;
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.message.incoming {
    align-self: flex-start;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    border-top-left-radius: 2px;
}

.message.outgoing {
    align-self: flex-end;
    background-color: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-top-right-radius: 2px;
    color: var(--neon-blue);
}

.message-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.status-icon.sent::after { content: "✓"; font-weight: bold;}
.status-icon.delivered::after { content: "✓✓"; font-weight: bold;}
.status-icon.read::after { content: "✓✓"; color: #3b82f6; font-weight: bold;}

.room-input {
    padding: 16px 24px;
    background-color: rgba(10, 15, 29, 0.8);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    align-items: center;
}

.room-input input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 14px 20px;
    background-color: rgba(0,0,0,0.2);
    color: var(--text-main);
    transition: all 0.2s;
}

.room-input input:focus {
    outline: none;
    background-color: rgba(0,0,0,0.4);
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 4px rgba(0, 210, 255, 0.15);
}

.room-input button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
    transition: all 0.2s;
}
.room-input button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background-color: var(--bg-panel);
    padding: 40px;
    border-radius: var(--radius-xl);
    width: 440px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.05);
    animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; }
.modal-content p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 24px; line-height: 1.5; }
.modal-content button { margin-top: 24px; width: 100%; }

/* Lists and Tables */
.result-list {
    list-style: none;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-list li {
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.result-list li:hover {
    border-color: var(--neon-blue);
    background: rgba(0, 210, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.1);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
}

th {
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.95rem;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Badge untuk tabel/status */
.badge-status {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-status.active, .badge-status.sent, .badge-status.delivered, .badge-status.read { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-status.pending, .badge-status.received { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-status.failed { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--surface);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: #f59e0b; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* --- TEMPLATE BUILDER UI --- */
.template-builder-container {
    display: flex;
    background: rgba(10, 15, 29, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    min-height: 500px;
    overflow: hidden;
    margin-top: 20px;
}

.template-sidebar {
    width: 280px;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-type-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.template-type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.template-type-btn.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.template-content-area {
    flex: 1;
    padding: 30px;
    background: transparent;
}

.template-content-area label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
}

.template-content-area input[type="text"],
.template-content-area input[type="file"],
.template-content-area textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
    color: var(--text-main);
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

.template-content-area input[type="text"]:focus,
.template-content-area textarea:focus {
    border-color: var(--neon-blue);
    outline: none;
    background: rgba(0,0,0,0.4);
}

.template-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}
/* --- PHONE PREVIEW MOCKUP --- */
.mock-phone {
    width: 320px;
    height: 550px;
    background: #e5ddd5;
    border: 12px solid #111827;
    border-radius: 36px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.mock-phone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 25px;
    background: #111827;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    z-index: 10;
}
.mock-phone-header {
    background: #075e54;
    color: #fff;
    padding: 35px 15px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mock-phone-avatar {
    width: 35px;
    height: 35px;
    background: #dfe5e7;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.mock-phone-avatar i {
    color: #fff;
    margin-top: 5px;
}
.mock-phone-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mock-phone-body {
    flex: 1;
    background-color: #efeae2;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-size: cover;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.mock-message-bubble {
    background: #dcf8c6;
    align-self: flex-end;
    padding: 8px 10px 4px 10px;
    border-radius: 8px;
    border-top-right-radius: 0;
    max-width: 85%;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    position: relative;
    font-size: 0.9rem;
    color: #111;
    word-break: break-word;
    margin-top: 10px;
}
.mock-message-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-top: 10px solid #dcf8c6;
    border-right: 10px solid transparent;
}
#preview-image-container img {
    max-width: 100%;
    border-radius: 6px;
    margin-bottom: 5px;
}
#preview-text {
    white-space: pre-wrap;
    padding-bottom: 12px;
}
.mock-message-time {
    font-size: 0.65rem;
    color: #667781;
    text-align: right;
    position: absolute;
    bottom: 4px;
    right: 8px;
    display: flex;
    align-items: center;
}
.mock-phone-footer {
    background: #f0f0f0;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mock-input-bar {
    flex: 1;
    background: #fff;
    padding: 10px 15px;
    border-radius: 24px;
    color: #8696a0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
.mock-mic-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #00a884;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
/* --- TEMPLATE LIST CARDS --- */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.template-card {
    background: rgba(10, 15, 29, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}
.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}
.template-card-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.05rem;
    word-break: break-all;
}
.template-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.template-badge.media { background: rgba(0, 210, 255, 0.1); color: var(--neon-blue); }
.template-badge.text { background: rgba(255, 255, 255, 0.1); color: var(--text-main); }
.template-card-body {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}
.template-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    padding-top: 15px;
}
.template-file-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}
.template-file-link:hover { text-decoration: underline; }
.btn-delete-template {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}
.btn-delete-template:hover {
    background: #fee2e2;
}

/* --- NEW BROADCAST PLATFORM STACKED CARDS --- */
.platform-stacked-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.02);
    border: 2px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 16px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.platform-stacked-card:hover {
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
}

.hidden-platform-radio:checked + .platform-stacked-card {
    background: rgba(0, 210, 255, 0.05);
    border-color: var(--neon-blue);
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.15);
}

.radio-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.hidden-platform-radio:checked + .platform-stacked-card .radio-circle {
    border-color: var(--neon-blue);
    background: rgba(0, 210, 255, 0.2);
}

.hidden-platform-radio:checked + .platform-stacked-card .radio-circle::after {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--neon-blue);
    box-shadow: var(--neon-glow);
}

/* Fix untuk dropdown option agar tidak putih/tidak terlihat */
select option {
    background-color: var(--bg-sidebar);
    color: var(--text-main);
    padding: 10px;
}
