/* ========================================
   ISAK Broadcast System — Fresh Build v10
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --blue: #0066B3;
    --blue-dark: #004d87;
    --blue-light: #E8F4FD;
    --blue-vibrant: #1a8cff;
    --green: #00A651;
    --green-dark: #008a43;
    --green-light: #E6F7EE;
    --green-vibrant: #00cc63;
    --teal: #0891b2;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #ffffff;
    color: var(--gray-800);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   Navbar
   ======================================== */

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 72px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02), 0 4px 24px rgba(0, 0, 0, 0.03);
    animation: slideDown 0.7s ease both;
}

.nav-gradient-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue), var(--green), var(--teal), var(--blue));
    background-size: 300% 100%;
    animation: gradFlow 8s linear infinite;
    opacity: 0.6;
}

@keyframes gradFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 300% 50%;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-right {
    animation: slideDown 0.7s ease 0.2s both;
}


.logo-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    animation: slideDown 0.7s ease 0.1s both;
}

.nav-brand-img {
    height: 64px;
    /* Slightly larger */
    width: auto;
    object-fit: contain;
    transition: var(--transition-spring);
    mix-blend-mode: multiply;
    display: block;
}

.login-brand-img {
    height: 100px;
    /* Reduced from 120px */
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
    margin-bottom: 24px;
    /* More space */
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.logo-container:hover .nav-brand-img {
    transform: scale(1.05) rotate(-2deg);
    /* No shadow on hover to keep it clean */
}

.nav-divider {
    width: 1px;
    height: 28px;
    background: linear-gradient(180deg, transparent, var(--gray-200), transparent);
    flex-shrink: 0;
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.03em;
}

.nav-title .sep {
    color: var(--gray-300);
    margin: 0 3px;
    font-weight: 300;
}

.nav-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
    width: fit-content;
    padding: 2px 8px;
    border-radius: 100px;
    background: linear-gradient(135deg, var(--blue), var(--green));
    color: white;
}

.badge-dot {
    width: 5px;
    height: 5px;
    background: #7cffb2;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--green-light);
    border: 1px solid rgba(0, 166, 81, 0.1);
    border-radius: 100px;
    transition: var(--transition);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(0, 166, 81, 0.4);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--green-dark);
}

.nav-actions {
    display: flex;
    gap: 4px;
}

.nav-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: transparent;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xs);
    color: var(--gray-500);
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-action-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 179, 0.08);
}

.nav-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 4px;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-profile:hover {
    background: var(--gray-50);
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 0 0 2px white, 0 0 0 3px rgba(0, 102, 179, 0.15);
    transition: var(--transition);
}

.nav-profile:hover .profile-avatar {
    box-shadow: 0 0 0 2px white, 0 0 0 4px rgba(0, 166, 81, 0.25);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.2;
}

.profile-role {
    font-size: 0.6rem;
    color: var(--gray-400);
    font-weight: 500;
}

/* ========================================
   Layout
   ======================================== */

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 36px 60px;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
    align-items: start;
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 28px;
    transition: var(--transition);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02), 0 8px 32px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.preview-card {
    display: none;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue), var(--green), var(--blue));
    background-size: 200% 100%;
    opacity: 0;
    transition: var(--transition);
    animation: gradFlow 4s linear infinite;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 102, 179, 0.08);
    transform: translateY(-2px);
}

.card:hover::before {
    opacity: 1;
}

.broadcast-card {
    animation: cardUp 0.6s ease 0.15s both;
}

.sidebar {
    animation: cardUp 0.6s ease 0.3s both;
}

@keyframes cardUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--gray-100);
}

.card-icon-wrap {
    position: relative;
}

.card-icon {
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue-light), rgba(0, 166, 81, 0.06));
    border-radius: var(--radius-sm);
    transition: var(--transition-spring);
}

.card-icon-ring {
    position: absolute;
    inset: -3px;
    border-radius: 13px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--blue), var(--green)) border-box;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    opacity: 0.3;
}

.card-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.card-description {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ========================================
   Form Elements
   ======================================== */

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-800);
    cursor: pointer;
    appearance: none;
    transition: var(--transition);
    outline: none;
}

.select-wrapper::after {
    content: '▾';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.select-wrapper select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.1);
}

textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-800);
    resize: vertical;
    min-height: 140px;
    transition: var(--transition);
    outline: none;
    line-height: 1.65;
}

textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.1);
}

textarea::placeholder {
    color: var(--gray-400);
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.char-count,
.lang-hint {
    font-size: 0.7rem;
    color: var(--gray-400);
}

/* Type Buttons */
.type-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    font-size: 0.76rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition-spring);
    outline: none;
}

.type-icon {
    font-size: 1.2rem;
    transition: var(--transition-spring);
}

.type-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 102, 179, 0.12);
}

.type-btn.active {
    border-color: var(--blue);
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: var(--white);
    box-shadow: 0 4px 20px rgba(0, 102, 179, 0.3);
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

.btn {
    padding: 11px 22px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-spring);
    outline: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 166, 81, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 28px rgba(0, 166, 81, 0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
    border: 1.5px solid var(--gray-200);
}

.btn-ghost:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-700);
    transform: translateY(-1px);
}

/* ========================================
   WhatsApp Preview
   ======================================== */

.preview-card {
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(0, 102, 179, 0.06);
}

.card-header-sm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--gray-100);
}

.live-badge {
    font-size: 0.56rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--green), var(--green-vibrant));
    padding: 2px 8px;
    border-radius: 100px;
    letter-spacing: 0.1em;
}

.wa-header-bar {
    background: linear-gradient(135deg, #075e54, #128c7e);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--blue-vibrant), var(--green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.45rem;
    font-weight: 800;
    color: white;
}

.wa-header-text {
    display: flex;
    flex-direction: column;
}

.wa-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.wa-status-text {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
}

.wa-chat-area {
    background: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4cfc6' fill-opacity='0.3'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    padding: 16px;
    min-height: 160px;
}

.wa-bubble {
    background: white;
    border-radius: 0 12px 12px 12px;
    padding: 10px 14px;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.wa-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 4px;
}

.wa-message {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--gray-800);
}

.wa-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.wa-time {
    font-size: 0.62rem;
    color: var(--gray-400);
}

.wa-check {
    font-size: 0.62rem;
    color: #53bdeb;
}

/* Stats */
.stats-card {
    padding: 0;
    margin-top: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.stat-item:nth-child(odd) {
    border-right: 1px solid var(--gray-100);
}

.stat-item:nth-child(n+3) {
    border-bottom: none;
}

.stat-item:hover {
    background: var(--gray-50);
}

.stat-icon {
    font-size: 1.1rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 0.62rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-spring);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-icon {
    font-size: 1.5rem;
}

.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-text {
    font-size: 0.88rem;
    color: var(--gray-600);
    margin-bottom: 16px;
}

.modal-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--gray-700);
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========================================
   Toast
   ======================================== */

.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gray-900);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-spring);
    overflow: hidden;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 22px;
    height: 22px;
    background: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 600;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green));
    transform: scaleX(0);
    transform-origin: left;
}

.toast.show .toast-progress {
    animation: toastProgress 3.5s linear forwards;
}

@keyframes toastProgress {
    to {
        transform: scaleX(1);
    }
}

/* ========================================
   Login Screen
   ======================================== */

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    opacity: 1;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.login-card {
    width: 100%;
    max-width: 400px;
    /* Reuse .card styles */
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: scaleUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-header {
    text-align: center;
}

.login-logo {
    /* Removed fixed width/height to let image size itself */
    margin: 0 auto 16px;
}

.login-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(0, 102, 179, 0.2));
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--gray-500);
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}