/* ============================================
   WA BOT MANAGER - MODERN CLEAN UI
   Inspired by clean dashboard design
   ============================================ */

:root {
    /* Primary Colors - Green Theme */
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #D4F4DD;
    --accent: #00A884;

    /* Neutral Colors */
    --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;

    /* Status Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 72px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.logo-text {
    flex: 1;
}

.logo-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

.status-card {
    background: var(--gray-50);
    padding: 12px;
    border-radius: var(--radius);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 500;
    margin-bottom: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-time {
    font-size: 11px;
    color: var(--gray-500);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--gray-500);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================
   STATS GRID
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.green {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.stat-icon.orange {
    background: #FEF3C7;
    color: #D97706;
}

.stat-icon.blue {
    background: #DBEAFE;
    color: #1D4ED8;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.stat-value.small {
    font-size: 24px;
}

.stat-trend {
    font-size: 12px;
    font-weight: 500;
}

.stat-trend.positive {
    color: var(--success);
}

.stat-trend.neutral {
    color: var(--gray-400);
}

/* ============================================
   ACTION CARDS
   ============================================ */

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.action-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.action-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.action-card p {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn svg {
    display: block;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.select-sm {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
}

/* ============================================
   BOT LIST
   ============================================ */

.bot-list {
    display: grid;
    gap: 16px;
}

.bot-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.bot-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.bot-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 20px;
}

.bot-details {
    flex: 1;
}

.bot-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.bot-phone {
    color: var(--gray-500);
    font-size: 13px;
}

.bot-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
}

.bot-status.active {
    background: #D1FAE5;
    color: #065F46;
}

.bot-status.pending {
    background: #FEF3C7;
    color: #92400E;
}

.bot-status.logout {
    background: #FEE2E2;
    color: #991B1B;
}

/* ============================================
   SCHEDULE LIST
   ============================================ */

.schedule-list {
    display: grid;
    gap: 16px;
}

.schedule-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.schedule-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.schedule-time {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.schedule-mode {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-600);
}

.schedule-body {
    margin-bottom: 16px;
}

.schedule-message {
    color: var(--gray-600);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.schedule-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--gray-500);
}

.schedule-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.schedule-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================
   LOGS
   ============================================ */

.logs-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.log-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.log-item:last-child {
    border-bottom: none;
}

.log-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.log-icon.info {
    background: #DBEAFE;
    color: #1D4ED8;
}

.log-icon.success {
    background: #D1FAE5;
    color: #065F46;
}

.log-icon.warning {
    background: #FEF3C7;
    color: #92400E;
}

.log-icon.error {
    background: #FEE2E2;
    color: #991B1B;
}

.log-content {
    flex: 1;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.log-category {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-time {
    font-size: 11px;
    color: var(--gray-400);
}

.log-message {
    font-size: 14px;
    color: var(--gray-700);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.empty-state small {
    font-size: 13px;
    color: var(--gray-400);
}

/* ============================================
   TOAST
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
}

.toast {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--gray-700);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet & Mobile */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 1000;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .logo {
        padding: 16px 20px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .logo-title {
        font-size: 15px;
    }

    .logo-subtitle {
        font-size: 10px;
    }

    .nav {
        display: flex;
        overflow-x: auto;
        padding: 8px 12px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .nav-item span {
        display: inline;
    }

    .sidebar-footer {
        display: none;
    }

    .main {
        margin-left: 0;
        padding: 20px 16px;
        min-height: calc(100vh - 140px);
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .action-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .action-card {
        padding: 20px;
    }

    .bot-card {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px;
    }

    .bot-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .bot-avatar {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .bot-status {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .schedule-card {
        padding: 16px;
    }

    .schedule-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .schedule-time {
        font-size: 18px;
    }

    .schedule-footer {
        flex-wrap: wrap;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
    }

    .btn-sm {
        padding: 10px 16px;
        font-size: 14px;
    }

    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    .log-item {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
    }

    .log-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .main {
        padding: 16px 12px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .action-card h3 {
        font-size: 15px;
    }

    .action-card p {
        font-size: 13px;
    }

    .bot-name {
        font-size: 14px;
    }

    .schedule-title {
        font-size: 15px;
    }

    .schedule-message {
        font-size: 13px;
    }

    .schedule-meta {
        flex-direction: column;
        gap: 8px;
    }
}

.hidden {
    display: none !important;
}