/* ========================================
   Global Styles
   ======================================== */
   :root {
    --primary-color: #25D366;
    --primary-hover: #20ba59;
    --secondary-color: #075E54;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --bg-light: #F9FAFB;
    --white: #FFFFFF;
    --danger: #EF4444;
    --success: #10B981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    font-size: 14px;
}

/* Arabic Font */
body[dir="rtl"] {
    font-family: 'Cairo', sans-serif;
}

/* ========================================
   Language Switcher
   ======================================== */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

body[dir="rtl"] .language-switcher {
    right: auto;
    left: 20px;
}

.language-switcher .btn {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.language-switcher .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   Auth Page Styles
   ======================================== */
.auth-page {
    position: relative;
}

.auth-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-xl);
    transition: transform 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-5px);
}

.logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* ========================================
   Form Styles
   ======================================== */
.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.15);
}

.input-group-text {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: var(--text-muted);
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
}

body[dir="rtl"] .input-group-text {
    border-right: 2px solid var(--border-color);
    border-left: none;
    border-radius: 0 10px 10px 0;
}

body[dir="rtl"] .input-group .form-control {
    border-right: none;
    border-left: 2px solid var(--border-color);
    border-radius: 10px 0 0 10px;
}

/* Country Code Select */
.country-code {
    border-right: none !important;
    border-radius: 10px 0 0 10px !important;
    background: var(--bg-light);
    font-weight: 600;
}

body[dir="rtl"] .country-code {
    border-left: none !important;
    border-right: 2px solid var(--border-color) !important;
    border-radius: 0 10px 10px 0 !important;
}

/* ========================================
   Button Styles
   ======================================== */
.btn-primary {
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-link {
    color: var(--primary-color);
    font-weight: 600;
}

.btn-link:hover {
    color: var(--primary-hover);
}

/* ========================================
   OTP Styles
   ======================================== */
.otp-icon {
    font-size: 60px;
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.otp-input {
    width: 50px;
    height: 55px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.otp-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.15);
    transform: scale(1.05);
}

#timer {
    color: var(--danger);
    font-weight: 600;
}

#resendBtn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ========================================
   Dashboard Styles
   ======================================== */
.sidebar {
    width: 250px;
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: var(--shadow-md);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

body[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-brand {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
}

.sidebar-menu {
    list-style: none;
    padding: 16px;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--primary-color);
    color: var(--white);
}

.sidebar-menu i {
    margin-right: 12px;
    font-size: 18px;
}

body[dir="rtl"] .sidebar-menu i {
    margin-right: 0;
    margin-left: 12px;
}

.sidebar-footer {
    padding: 16px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 24px;
    min-height: 100vh;
    background: var(--bg-light);
}

body[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 250px;
}

/* Top Bar */
.top-bar {
    background: var(--white);
    padding: 20px 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.search-box {
    position: relative;
    display: inline-block;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

body[dir="rtl"] .search-box i {
    left: auto;
    right: 12px;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 250px;
    transition: all 0.3s ease;
}

body[dir="rtl"] .search-box input {
    padding: 8px 36px 8px 12px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.15);
}

/* Cards */
.dashboard-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Stats Card */
.stats-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stats-icon.primary {
    background: rgba(37, 211, 102, 0.1);
    color: var(--primary-color);
}

.stats-icon.secondary {
    background: rgba(7, 94, 84, 0.1);
    color: var(--secondary-color);
}

.stats-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Instance Card */
.instance-card {
    transition: all 0.3s ease;
}

.instance-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.instance-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 20px;
}

.instance-label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
}

.instance-stat {
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
}

.message-platforms {
    font-size: 14px;
    flex-wrap: wrap;
}

.message-platforms .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.instance-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

/* QR Code Styles */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    background: var(--bg-light);
}

#qrCode {
    padding: 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

/* Empty State */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-light);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

/* Stats Card Small */
.stats-card-sm {
    padding: 20px;
    transition: all 0.3s ease;
}

.stats-card-sm:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Contact & Message Items */
.contact-item,
.message-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    background: var(--white);
}

.contact-item:hover,
.message-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.message-item {
    position: relative;
}

.message-item .message-text {
    padding-right: 40px;
}

body[dir="rtl"] .message-item .message-text {
    padding-right: 0;
    padding-left: 40px;
}

.message-item .message-actions {
    position: absolute;
    top: 12px;
    right: 12px;
}

body[dir="rtl"] .message-item .message-actions {
    right: auto;
    left: 12px;
}

/* Campaign Item */
.campaign-item {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--white);
    transition: all 0.3s ease;
}

.campaign-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    padding: 12px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    background: transparent;
}

/* Interactive Messages Styles */
.interactive-banner {
    background: linear-gradient(135deg, #25D366 0%, #075E54 100%);
    padding: 40px;
    margin-bottom: 24px;
}

.empty-state-inline {
    padding: 40px 20px;
}

/* WhatsApp Preview */
.whatsapp-preview {
    background: #E5DDD5;
    padding: 20px;
    border-radius: 12px;
    min-height: 400px;
}

.whatsapp-message {
    background: var(--white);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 350px;
}

.message-title {
    font-size: 16px;
    color: var(--text-dark);
}

.message-body {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.5;
}

.message-footer {
    font-size: 12px;
}

/* Section Item */
.section-item {
    background: var(--bg-light);
}

/* Stat Box */
.stat-box {
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
}

/* Menu Header */
.menu-header {
    padding: 12px 16px 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 16px;
    list-style: none;
}

/* Token Display */
.token-display {
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

/* Table */
.table-responsive {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-light);
    border: none;
    font-weight: 600;
    color: var(--text-dark);
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-color: var(--border-color);
}

/* Badge */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .auth-card {
        padding: 30px 20px;
    }

    .language-switcher {
        top: 15px;
        right: 15px;
    }

    .otp-input {
        width: 45px;
        height: 50px;
        font-size: 20px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 9999;
    }

    body[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 16px;
    }

    body[dir="rtl"] .main-content {
        margin-right: 0 !important;
    }
    
    .mobile-menu-toggle {
        display: block !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card,
.dashboard-card {
    animation: fadeIn 0.5s ease;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.rounded-lg {
    border-radius: 16px !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}