/* Kuwait Social AI - Admin Panel Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--dark);
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.sidebar-logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--light);
    color: var(--dark);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
}

.search-box {
    position: relative;
    width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-btn {
    background: none;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.header-btn:hover {
    background: var(--light);
    color: var(--dark);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    background: var(--light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--secondary);
}

.breadcrumb a {
    color: var(--secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* Cards */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: rgba(37, 99, 235, 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.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light);
    border-bottom: 1px solid var(--border);
}

th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: rgba(248, 250, 252, 0.5);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    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: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--light);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.375rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.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-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Filters */
.table-filters {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-item label {
    display: block;
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.filter-item input,
.filter-item select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Loading & Toast */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@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(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .search-box {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-filters {
        flex-direction: column;
    }
    
    .filter-item {
        min-width: 100%;
    }
    
    .content {
        padding: 1rem;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.gap-5 { gap: 2rem; }/* Add Client Button Fix */
.btn-primary { background: #2563eb \!important; color: white \!important; opacity: 1 \!important; visibility: visible \!important; display: inline-flex \!important; }
.table-actions { opacity: 1 \!important; }
.table-actions .btn { opacity: 1 \!important; visibility: visible \!important; }
/* Comprehensive Button Visibility Fix */

/* Reset any inherited transparency */
.table-header,
.table-actions,
.btn {
    opacity: 1 !important;
    visibility: visible !important;
    filter: none !important;
    -webkit-filter: none !important;
    transform: none !important;
}

/* Ensure primary buttons are visible */
.btn-primary {
    /* Force solid background */
    background: #2563eb !important;
    background-color: #2563eb !important;
    background-image: none !important;
    
    /* Force white text */
    color: #ffffff !important;
    
    /* Remove any transparency */
    opacity: 1 !important;
    visibility: visible !important;
    
    /* Ensure it's displayed */
    display: inline-flex !important;
    align-items: center !important;
    
    /* Standard button styling */
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    border: none !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    
    /* Ensure it's above other elements */
    position: relative !important;
    z-index: 10 !important;
}

.btn-primary:hover {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Ensure icons in buttons are visible */
.btn i,
.btn svg {
    color: inherit !important;
    opacity: 1 !important;
    margin-right: 0.5rem !important;
}


/* Fix icon centering in icon-only buttons */
.btn-icon i,
.btn-icon svg {
    margin-right: 0 !important;}
/* Fix table actions container */
.table-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    background: transparent !important;
}

/* Specific fix for Add Client button */
button[onclick*="showAddClientModal"],
button[onclick*="AddClient"],
.btn:contains("Add Client") {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Debug mode - uncomment to see button borders */
/*
.btn-primary {
    border: 3px solid red !important;
    box-shadow: 0 0 10px red !important;
}
*//* Fix for transparent modal and form elements */

/* Ensure modal backdrop is visible */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5) !important;
    opacity: 1 !important;
}

/* Ensure modal is visible with solid background */
.modal {
    background: #ffffff !important;
    background-color: #ffffff !important;
    opacity: 1 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid #e5e7eb !important;
}

/* Ensure modal header is visible */
.modal-header {
    background: #f9fafb !important;
    opacity: 1 !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* Ensure modal body is visible */
.modal-body {
    background: #ffffff !important;
    opacity: 1 !important;
}

/* Ensure all form elements are visible */
.form-group {
    opacity: 1 !important;
}

.form-group label {
    color: #374151 !important;
    opacity: 1 !important;
    font-weight: 500 !important;
}

/* Ensure all inputs and selects are visible */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="tel"],
.modal input[type="password"],
.modal input[type="number"],
.modal select,
.modal textarea,
#clientForm input,
#clientForm select,
#clientForm textarea {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #111827 !important;
    opacity: 1 !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.375rem !important;
}

/* Focus states */
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
    border-color: #2563eb !important;
    outline: 2px solid transparent !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* Modal footer */
.modal-footer {
    background: #f9fafb !important;
    opacity: 1 !important;
    border-top: 1px solid #e5e7eb !important;
}

/* Ensure buttons in modal are visible */
.modal .btn,
.modal-footer .btn {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Specific fix for form rows */
.form-row {
    opacity: 1 !important;
    background: transparent !important;
}

/* Placeholder text visibility */
.modal input::placeholder,
.modal textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}
