/* Modern Super Admin Dashboard CSS */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00a149;
    --primary-dark: #004724;
    --secondary: #319131;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1f2937;
    --light: #f9fafb;
    --border: #e5e7eb;
    --text: #374151;
    --text-light: #6b7280;
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    overflow-y: auto;
    transition: transform 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-header h2 .sidebar-logo,
.sidebar-header h2 img.sidebar-logo {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
    display: block;
}

.sidebar-header p {
    font-size: 0.875rem;
    opacity: 0.8;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: white;
    text-decoration: none;
    transition: background 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: rgba(255,255,255,0.2);
    border-left: 3px solid white;
}

.nav-item i {
    margin-right: 0.75rem;
    width: 20px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
}

/* RTL Toggle Button */
.rtl-toggle-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    font-weight: 500;
}

.rtl-toggle-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.rtl-toggle-btn.active {
    background: var(--success);
}

.rtl-toggle-btn i {
    font-size: 0.875rem;
}

.content {
    padding: 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(0, 161, 73, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #00a149;
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 161, 73, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light);
}

th {
    padding: 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: 0.875rem;
}

td {
    padding: 0.875rem;
    border-top: 1px solid var(--border);
}

tr:hover {
    background: var(--light);
}

/* Badge */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
}

/* Plan Modal Specific Styles */
.modal-content .row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-content .col-md-4 {
    flex: 1 1 calc(33.333% - 0.75rem);
    min-width: 150px;
}

.modal-content .col-md-6 {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 200px;
}

.modal-content .form-group {
    margin-bottom: 1rem;
}

.modal-content hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.modal-content .switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0;
}

.modal-content .switch-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.modal-content .switch-label span {
    font-weight: 500;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Plan Modal Responsive */
@media (max-width: 768px) {
    .modal-content .row {
        flex-direction: column;
    }
    
    .modal-content .col-md-4,
    .modal-content .col-md-6 {
        flex: 1 1 100%;
    }
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.col-md-6 {
    flex: 0 0 calc(50% - 0.5rem);
}

.col-md-4 {
    flex: 0 0 calc(33.333% - 0.667rem);
}

.col-md-3 {
    flex: 0 0 calc(25% - 0.75rem);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 161, 73, 0.1);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

input[type="color"].form-control {
    height: 50px;
    padding: 4px;
    cursor: pointer;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group .form-control {
    flex: 1;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.875rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.spinner {
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination button {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        margin-bottom: 1.25rem;
    }

    .col-md-6,
    .col-md-4,
    .col-md-3 {
        flex: 1 1 100%;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        flex-shrink: 0;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* ==================== CHARTS & ANALYTICS ==================== */

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  min-height: 400px;
}

.chart-container {
  padding: 20px;
  height: 300px;
  position: relative;
}

.chart-container canvas {
  max-height: 100%;
}

/* ==================== PAYMENT DETAILS ==================== */

.payment-details {
  padding: 10px 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row strong {
  color: #333;
  font-weight: 600;
}

.detail-row code {
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #e83e8c;
}

/* ==================== FILTERS BAR ==================== */

.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select,
.filter-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  min-width: 150px;
}

.filter-input {
  flex: 1;
  max-width: 300px;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 161, 73, 0.1);
}

/* ==================== HEADER ACTIONS ==================== */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--dark);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.header-actions .btn {
  white-space: nowrap;
}

.header-actions .btn i {
  font-size: 0.875rem;
}

/* ==================== TABS ==================== */

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(0, 161, 73, 0.05);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(0, 161, 73, 0.05);
}

.tab-btn i {
  font-size: 1rem;
}

.tab-content {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== RESPONSIVE CHARTS ==================== */

@media (max-width: 768px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
  
  .chart-card {
    min-height: 300px;
  }
  
  .chart-container {
    height: 250px;
  }
  
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-select,
  .filter-input {
    width: 100%;
    max-width: none;
  }
  
  .detail-row {
    flex-direction: column;
    gap: 5px;
  }
}

/* ==================== LOADING STATES ==================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  font-size: 3em;
  color: var(--primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==================== EMPTY STATES ==================== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state i {
  font-size: 4em;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state h3 {
  margin-bottom: 10px;
  color: #666;
}

.empty-state p {
  color: #999;
  margin-bottom: 20px;
}

/* ==================== TOOLTIPS ==================== */

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* ==================== PRINT STYLES ==================== */

@media print {
  .sidebar,
  .header,
  .btn,
  .pagination,
  .filters-bar {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}

/* ==================== NOTIFICATION PAGES ==================== */

.nav-divider {
    padding: 15px 20px 5px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 1px;
}

.template-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.template-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.template-header h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
}

.template-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.template-body {
    color: #666;
}

.template-body p {
    margin: 8px 0;
}

.template-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.6;
}

.whatsapp-preview {
    background: #dcf8c6;
    border-left: 3px solid #25d366;
}

.whatsapp-preview-box {
    margin-top: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 8px;
}

.whatsapp-message {
    background: #dcf8c6;
    padding: 15px;
    border-radius: 8px;
    max-width: 400px;
    margin-top: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.card-actions select,
.card-actions input {
    max-width: 200px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-success {
    background: #48bb78;
    color: white;
}

.badge-warning {
    background: #ed8936;
    color: white;
}

.badge-info {
    background: #4299e1;
    color: white;
}

.badge-danger {
    background: #f56565;
    color: white;
}

.badge-secondary {
    background: #718096;
    color: white;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    z-index: 1;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.switch input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
    z-index: 2;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 3;
}

.switch input:checked + .slider {
    background-color: var(--primary);
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
}

.slider:hover {
    opacity: 0.9;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-lg {
    max-width: 900px;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .template-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .template-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions select,
    .card-actions input {
        max-width: 100%;
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
}


/* ==================== MODAL SYSTEM ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
}

.modal-dialog.modal-sm {
    max-width: 400px;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--light);
    color: var(--dark);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(400px);
    transition: transform 0.3s;
    border-left: 4px solid var(--info);
}

.toast.show {
    transform: translateX(0);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--info);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    color: var(--text);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--light);
    color: var(--dark);
}

/* ==================== RTL SUPPORT ==================== */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .toast-container {
    right: auto;
    left: 20px;
}

[dir="rtl"] .toast {
    transform: translateX(-400px);
    border-left: none;
    border-right: 4px solid var(--info);
}

[dir="rtl"] .toast.show {
    transform: translateX(0);
}

[dir="rtl"] .toast.toast-success {
    border-right-color: var(--success);
}

[dir="rtl"] .toast.toast-error {
    border-right-color: var(--danger);
}

[dir="rtl"] .toast.toast-warning {
    border-right-color: var(--warning);
}

[dir="rtl"] .toast.toast-info {
    border-right-color: var(--info);
}

[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    [dir="rtl"] .main-content {
        margin-right: 0;
    }
    
    .modal-dialog {
        max-width: 95%;
    }
    
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    [dir="rtl"] .toast-container {
        right: 10px;
        left: 10px;
    }
}


/* ==================== LANGUAGE SELECTOR ==================== */
.language-selector {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.language-selector:hover {
    border-color: var(--primary);
}

.language-selector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 161, 73, 0.1);
}

/* ===== ADDON PURCHASES ===== */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-stripe {
  background: #635bff;
  color: white;
}

.badge-paypal {
  background: #0070ba;
  color: white;
}

.badge-cash {
  background: #27ae60;
  color: white;
}

.btn-group {
  display: flex;
  gap: 5px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: #f8f9fa;
}

.data-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #dee2e6;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 18px;
  margin: 0;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #6c757d;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 20px;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
}

.modal-dialog {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

.modal-sm {
  width: 90%;
  max-width: 400px;
}

.modal-medium {
  width: 90%;
  max-width: 600px;
}

.modal-large {
  width: 90%;
  max-width: 900px;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s;
}

.modal-close:hover {
  background: #f8f9fa;
  color: #000;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #dee2e6;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== ALERT ERROR ===== */
.alert-error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 20px;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.alert-error i {
  font-size: 24px;
  flex-shrink: 0;
}

.alert-error strong {
  display: block;
  font-size: 16px;
  margin-bottom: 5px;
}

.alert-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  padding: 20px;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.alert-warning i {
  font-size: 24px;
  flex-shrink: 0;
}


/* ==================== NOTIFICATION SYSTEM STYLES ==================== */

/* Switch Label */
.switch-label {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
}

/* Expiration Selects */
.expiration-selects .form-group {
    margin-bottom: 15px;
}

.expiration-selects select {
    width: 100%;
}

/* Template Card Enhancements */
.template-card .badge {
    font-size: 11px;
    padding: 4px 10px;
}

.badge-primary { background: var(--primary); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-info { background: var(--info); color: white; }
.badge-secondary { background: #6b7280; color: white; }

/* WhatsApp Connection States */
#connectedContainer,
#disconnectedContainer,
#qrCodeContainer {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Text Right */
.text-right {
    text-align: right;
}

[dir="rtl"] .text-right {
    text-align: left;
}

/* Row and Column Grid */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-md-2, .col-md-3, .col-md-4, .col-md-6, .col-md-12 {
    padding: 0 10px;
    box-sizing: border-box;
}

.col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

.col-6 { flex: 0 0 50%; max-width: 50%; padding: 0 10px; box-sizing: border-box; }

/* Margin Top */
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

/* Alert Info */
.alert-info {
    background: #e7f3ff;
    border: 1px solid #b6d4fe;
    color: #084298;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.alert-info code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* Button Block */
.btn-block {
    width: 100%;
}

/* Responsive for Notifications */
@media (max-width: 768px) {
    .col-md-2, .col-md-3, .col-md-4, .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .text-right {
        text-align: center;
    }
    
    .switch-label {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* RTL Support for Notifications */
[dir="rtl"] .template-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .form-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .alert-info {
    text-align: right;
}

[dir="rtl"] .whatsapp-preview {
    border-left: none;
    border-right: 3px solid #25d366;
}


/* ==================== USER DROPDOWN ==================== */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    color: var(--text);
    font-size: 14px;
}

.user-dropdown-toggle:hover {
    background: var(--light);
}

.user-dropdown-toggle i.fa-user-circle {
    font-size: 24px;
    color: var(--primary);
}

.user-dropdown-toggle i.fa-chevron-down {
    font-size: 12px;
    transition: transform 0.2s;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    padding: 8px 0;
    z-index: 1000;
    display: none;
    margin-top: 4px;
}

.user-dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--light);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--text-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

[dir="rtl"] .user-dropdown-menu {
    right: auto;
    left: 0;
}

[dir="rtl"] .dropdown-item {
    flex-direction: row-reverse;
}


/* ==================== HEADER CLOCK ==================== */
.header-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 0.25rem 1rem;
    border-right: 1px solid var(--border);
    margin-right: 0.5rem;
}

.clock-time {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    font-family: 'Segoe UI', monospace;
    line-height: 1.2;
}

.clock-date {
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.2;
}

/* Clock Toggle in Dropdown */
.clock-toggle-item {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    cursor: default !important;
}

.clock-toggle-item:hover {
    background: transparent !important;
}

.clock-toggle-item .switch {
    margin-left: auto;
}

.switch-sm {
    width: 40px;
    height: 20px;
}

.switch-sm .slider:before {
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
}

.switch-sm input:checked + .slider:before {
    transform: translateX(20px);
}

/* Timezone Preview Box */
.preview-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.preview-section h4 {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

.preview-box {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    color: white;
}

.preview-time {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Segoe UI', monospace;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.preview-date {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* User Dropdown Improvements */
.user-dropdown-menu {
    min-width: 220px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--light);
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--text-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* RTL Support for Clock */
[dir="rtl"] .header-clock {
    align-items: flex-start;
    border-right: none;
    border-left: 1px solid var(--border);
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .clock-toggle-item .switch {
    margin-left: 0;
    margin-right: auto;
}

/* Responsive Clock */
@media (max-width: 768px) {
    .header-clock {
        display: none !important;
    }
    
    .clock-time {
        font-size: 0.9rem;
    }
    
    .clock-date {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .preview-time {
        font-size: 1.8rem;
    }
    
    .preview-date {
        font-size: 0.85rem;
    }
}


/* ==================== SYSTEM ADD-ONS ==================== */

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--light);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(0, 161, 73, 0.05);
}

.upload-zone-content i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.upload-zone-content p {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 10px;
}

.upload-zone-content span {
    display: block;
    color: var(--text-light);
    margin-bottom: 15px;
}

.upload-progress {
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Add-ons Grid */
.addons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Add-on Card */
.addon-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.addon-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border);
    transition: background 0.3s ease;
}

.addon-card.active::before {
    background: var(--success);
}

.addon-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.addon-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.addon-icon i {
    font-size: 28px;
    color: white;
}

.addon-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.addon-info {
    flex: 1;
}

.addon-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 8px 0;
}

.addon-description {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.addon-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.addon-meta span {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

.addon-meta i {
    font-size: 11px;
}

.addon-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.addon-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.addon-card.active .toggle-label {
    color: var(--success);
}

.addon-buttons {
    display: flex;
    gap: 8px;
}

/* Empty State for Add-ons */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--border);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Nav Divider */
.nav-divider {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
    color: white;
}

/* Responsive Add-ons */
@media (max-width: 768px) {
    .addons-grid {
        grid-template-columns: 1fr;
    }
    
    .addon-card {
        padding: 15px;
    }
    
    .addon-icon {
        width: 50px;
        height: 50px;
    }
    
    .addon-icon i {
        font-size: 24px;
    }
    
    .upload-zone {
        padding: 30px 20px;
    }
    
    .upload-zone-content i {
        font-size: 36px;
    }
}

/* RTL Support for Add-ons */
[dir="rtl"] .addon-card::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .addon-meta {
    flex-direction: row-reverse;
}

[dir="rtl"] .addon-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .addon-toggle {
    flex-direction: row-reverse;
}
