/* ============================================
   Modern Glass Dark Theme - Bulut AI Admin
   طراحی کاملاً جدید و مدرن
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --accent: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* Glass Colors */
    --glass: rgba(30, 30, 45, 0.5);
    --glass-light: rgba(40, 40, 55, 0.6);
    --glass-dark: rgba(20, 20, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);
    
    /* Backgrounds */
    --bg: #0a0a0f;
    --bg-2: #111118;
    --bg-3: #1a1a24;
    
    /* Text */
    --text: #ffffff;
    --text-2: #b4b4c4;
    --text-3: #7a7a8a;
    
    /* Shadows */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    
    /* Gradients */
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-bg: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    
    /* Spacing */
    --s: 0.5rem;
    --m: 1rem;
    --l: 1.5rem;
    --xl: 2rem;
    
    /* Radius */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-full: 50px;
    
    /* Transition */
    --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: Inter, Vazirmatn, IRYekan, IRANSans, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    font-size: 0.875rem;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--gradient-bg);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--m);
    color: var(--text);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: var(--s);
    color: var(--text-2);
    font-size: 0.875rem;
}

code {
    background: var(--glass-dark);
    padding: 0.2rem 0.4rem;
    border-radius: var(--r-sm);
    font-family: 'Courier New', monospace;
    color: var(--primary-hover);
    font-size: 0.8rem;
    border: 1px solid var(--glass-border);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--l);
    position: relative;
    z-index: 1;
}

/* Glass Effect */
.glass {
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.glass-light {
    background: var(--glass-light);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border-hover);
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--m) var(--l);
    margin-bottom: var(--l);
    border-radius: var(--r-lg);
    position: relative;
    overflow: hidden;
}

.admin-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient);
    animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.logout-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.8rem;
    background: linear-gradient(135deg, var(--danger), #dc2626) !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: var(--r-md);
    transition: all var(--t);
    border: none;
    color: white;
    font-weight: 500;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Search Section */
.search-section {
    border-radius: var(--r-xl);
    padding: var(--xl);
    margin-bottom: var(--xl);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient);
    animation: shimmer 2.5s ease-in-out infinite;
}

.search-section h1 {
    text-align: center;
    margin-bottom: var(--xl);
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
    font-weight: 700;
}

.search-form {
    display: flex;
    gap: var(--m);
    align-items: flex-end;
}

.form-group {
    flex: 1;
}

.form-label {
    display: block;
    margin-bottom: var(--s);
    color: var(--text-2);
    font-weight: 500;
    font-size: 0.8rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--t);
    outline: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--glass-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow-glow);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: var(--text-3);
}

/* Buttons */
.btn {
    padding: 0.7rem 1.75rem;
    background: var(--gradient);
    border: none;
    border-radius: var(--r-md);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--t);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:hover::before {
    width: 250px;
    height: 250px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn:active {
    transform: translateY(0);
}

/* Alerts */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--r-md);
    margin-bottom: var(--m);
    border: 1px solid;
    animation: slideIn 0.3s ease;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

/* User Info Card */
.user-info-card {
    border-radius: var(--r-xl);
    padding: var(--xl);
    margin-bottom: var(--xl);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease 0.2s both;
}

.user-header {
    display: flex;
    align-items: center;
    gap: var(--l);
    margin-bottom: var(--xl);
    padding-bottom: var(--l);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    z-index: 1;
}

.user-avatar {
    width: 65px;
    height: 65px;
    border-radius: var(--r-full);
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    font-weight: bold;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: pulse 2.5s ease-in-out infinite;
    position: relative;
    border: 2px solid var(--glass-border);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.user-title h2 {
    margin: 0;
    font-size: 1.35rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-id {
    color: var(--text-2);
    font-size: 0.8rem;
    margin-top: var(--s);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--m);
    margin-bottom: var(--xl);
    position: relative;
    z-index: 1;
}

.stat-card {
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    padding: var(--l);
    transition: all var(--t);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease both;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--t);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--primary);
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card:nth-child(5) { animation-delay: 0.5s; }
.stat-card:nth-child(6) { animation-delay: 0.6s; }

.stat-label {
    color: var(--text-2);
    font-size: 0.7rem;
    margin-bottom: var(--s);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: var(--text);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-value.primary {
    color: var(--primary-hover);
}

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

.stat-value.warning {
    color: var(--warning);
}

.stat-value.info {
    color: var(--info);
}

/* Section Titles */
.section-title {
    color: var(--text);
    font-size: 1.1rem;
    margin-bottom: var(--l);
    padding-bottom: var(--s);
    position: relative;
    display: inline-block;
    font-weight: 600;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--gradient);
    border-radius: var(--r-full);
    animation: expandWidth 0.4s ease;
}

@keyframes expandWidth {
    from { width: 0; }
    to { width: 50px; }
}

.count-badge {
    font-size: 0.7rem;
    color: var(--text-3);
    font-weight: normal;
    margin-right: var(--s);
}

/* Tables */
.table-container {
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    padding: var(--l);
    margin-bottom: var(--xl);
    overflow-x: auto;
    animation: fadeIn 0.4s ease both;
    position: relative;
}

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

.table th {
    background: var(--glass-dark);
    color: var(--text);
    padding: 0.75rem;
    text-align: right;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.75rem;
    color: var(--text-2);
    border-bottom: 1px solid var(--glass-border);
    transition: all var(--t);
    vertical-align: middle;
    font-size: 0.8rem;
}

.table tbody tr {
    transition: all var(--t);
}

.table tbody tr:hover {
    background: var(--glass);
    transform: scale(1.005);
}

.table tbody tr:hover td {
    color: var(--text);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: var(--r-full);
    font-size: 0.7rem;
    font-weight: 600;
    transition: all var(--t);
    border: 1px solid transparent;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(6, 182, 212, 0.2);
    color: var(--info);
    border-color: rgba(6, 182, 212, 0.3);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Clickable Text */
.clickable-text {
    cursor: pointer !important;
    color: var(--primary-hover) !important;
    text-decoration: underline !important;
    text-decoration-color: transparent;
    transition: all var(--t);
    padding: 0.25rem 0.5rem;
    display: inline-block !important;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
    border-radius: var(--r-sm);
    background: rgba(99, 102, 241, 0.1) !important;
    border: 1px solid rgba(99, 102, 241, 0.2) !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    pointer-events: auto !important;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
}

.clickable-text:hover {
    color: var(--primary) !important;
    text-decoration-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: var(--primary) !important;
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.clickable-text:active {
    transform: translateX(-1px) scale(0.98);
}

.table td .clickable-text {
    max-width: 200px;
    display: inline-block !important;
    text-align: right;
    vertical-align: middle;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow-y: auto;
    overflow-x: hidden;
}

.modal.show,
.modal[style*="flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    width: 90%;
    max-width: 580px;
    max-height: 85vh;
    margin: var(--l) auto;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-25px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    min-height: 60px;
}

.modal-header h3 {
    margin: 0;
    padding: 0;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--t);
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    background: transparent;
    border: none;
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
    transform: rotate(90deg) scale(1.1);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.modal-text {
    color: var(--text);
    line-height: 1.7;
    font-size: 0.875rem;
    margin: 0;
    padding: 0;
}

.text-content {
    background: var(--glass-dark);
    padding: 1.25rem;
    border-radius: var(--r-md);
    border: 1px solid var(--glass-border);
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.8;
    color: var(--text);
    font-size: 0.875rem;
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-2);
    font-size: 0.75rem;
    line-height: 1.5;
}

.meta-item strong {
    color: var(--text);
    font-weight: 600;
}

/* Pagination */
.pagination {
    margin-top: var(--l);
    padding-top: var(--m);
    border-top: 1px solid var(--glass-border);
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--s);
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.9rem;
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-md);
    color: var(--text);
    cursor: pointer;
    transition: all var(--t);
    font-family: inherit;
    font-size: 0.8rem;
    min-width: 38px;
    font-weight: 500;
}

.pagination-btn:hover {
    background: var(--glass-light);
    border-color: var(--primary);
    color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.pagination-btn.active {
    background: var(--gradient);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.pagination-dots {
    color: var(--text-3);
    padding: 0 var(--s);
}

/* Loading & Empty */
.loading {
    text-align: center;
    padding: var(--xl);
    color: var(--text-2);
    font-size: 0.875rem;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.error {
    text-align: center;
    padding: var(--l);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    border-radius: var(--r-md);
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: var(--xl);
    color: var(--text-2);
    font-size: 0.875rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: var(--m);
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-2);
    border-radius: var(--r-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-dark);
    border-radius: var(--r-full);
    border: 2px solid var(--bg-2);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.modal-body::-webkit-scrollbar,
.text-content::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track,
.text-content::-webkit-scrollbar-track {
    background: var(--glass-dark);
    border-radius: var(--r-sm);
}

.modal-body::-webkit-scrollbar-thumb,
.text-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--r-sm);
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

::-moz-selection {
    background: var(--primary);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    html { font-size: 13px; }
    
    .container {
        padding: var(--m);
    }
    
    .search-section {
        padding: var(--l);
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .user-header {
        flex-direction: column;
        text-align: center;
    }
    
    .user-avatar {
        width: 55px;
        height: 55px;
        font-size: 1.25rem;
    }
    
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.1rem; }
    
    .table-container {
        padding: var(--m);
    }
    
    .table th,
    .table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .clickable-text {
        font-size: 0.7rem;
        max-width: 140px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.05rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .text-content {
        max-height: 280px;
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .admin-header {
        flex-direction: column;
        gap: var(--m);
        text-align: center;
    }
}

@media (max-width: 480px) {
    html { font-size: 12px; }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    .btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.8rem;
    }
}
