/* مسیر: assets/css/components.css */

/* Cards & Layout */
.card { background: var(--card); border-radius: 12px; padding: 15px; margin-bottom: 15px; border: 1px solid var(--border); box-shadow: 0 2px 5px rgba(0,0,0,0.02); transition: 0.3s; }
.section-title { font-size: 1rem; font-weight: 800; color: var(--text); opacity: 0.8; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* Forms & Inputs */
.form-group { margin-bottom: 10px; }
.form-label { font-size: 0.8rem; font-weight: bold; margin-bottom: 4px; display: block; opacity: 0.8; }
.form-control { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 6px; width: 100%; box-sizing: border-box; outline: none; font-family: inherit; font-size: 0.85rem; transition: border-color 0.2s; }
.form-control:focus { border-color: var(--primary); }
.select-quick { width: auto; min-width: 90px; cursor: pointer; background: var(--border); }
.grid-create { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }

/* Buttons */
.btn-main { background: var(--primary); color: white; border: none; padding: 10px 15px; border-radius: 8px; width: 100%; font-weight: bold; cursor: pointer; font-family: inherit; transition: 0.2s; text-align: center; }
.btn-main:hover { opacity: 0.9; transform: translateY(-1px); }

/* Alerts */
.alert { padding: 10px; border-radius: 8px; margin-bottom: 15px; text-align: center; font-size: 0.85rem; font-weight: bold; }
.alert.success { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid #10b981; }
.alert.danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid #ef4444; }
.warning-box { background: rgba(245,158,11,0.1); border: 1px solid #f59e0b; color: #d97706; padding: 12px 15px; border-radius: 10px; text-align: center; font-size: 0.9rem; font-weight: bold; margin-bottom: 20px; display: flex; justify-content: center; align-items: center; gap: 8px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 25px; padding-bottom: 30px; flex-wrap: wrap; }
.page-link { padding: 8px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); font-size: 0.85rem; font-weight: bold; transition: 0.2s; }
.page-link:hover { background: rgba(0,0,0,0.05); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Dashboard Specific: Finance Cards */
.finance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; margin-bottom: 25px; }
.finance-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; align-items: center; justify-content: space-between; transition: 0.3s; overflow: hidden; }
.finance-card:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.05); border-color: var(--primary); }
.finance-info h3 { margin: 0; font-size: 0.9rem; color: var(--text); opacity: 0.85; font-weight: bold; }
.finance-info .amount { font-size: 1.6rem; font-weight: 900; color: var(--text); margin-top: 5px; display: flex; align-items: baseline; gap: 5px; }
.finance-info .currency { font-size: 0.9rem; font-weight: bold; opacity: 0.9; }
.finance-icon-main { font-size: 1.8rem; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 10px; }

/* Dashboard Specific: Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 25px; }
.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 15px; text-align: center; transition: 0.2s; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.stat-box:hover { transform: scale(1.02); border-color: var(--text); }
.stat-icon { font-size: 1.3rem; }
.stat-value { font-size: 1.3rem; font-weight: 900; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.75rem; font-weight: bold; opacity: 0.7; }
.st-active .stat-value { color: #10b981; } .st-disabled .stat-value { color: #ef4444; } .st-hold .stat-value { color: #8b5cf6; }

/* Dashboard Specific: Quick Actions */
.action-container { background: var(--card); border: 1px dashed var(--border); border-radius: 15px; padding: 20px; text-align: center; margin-bottom: 15px; }
.btn-glow { background: linear-gradient(45deg, var(--primary), #f43f5e); color: white; padding: 12px 25px; border-radius: 30px; font-weight: bold; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; box-shadow: 0 5px 12px -3px var(--primary); transition: all 0.2s ease; border: none; }
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 8px 15px -3px var(--primary); color: white; }
.btn-outline { background: transparent; color: var(--text); padding: 12px 20px; border-radius: 30px; font-weight: bold; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; border: 1px solid var(--border); transition: all 0.2s ease; }
.btn-outline:hover { background: rgba(0,0,0,0.05); border-color: var(--text); }
.dark-mode .btn-outline:hover { background: rgba(255,255,255,0.05); }

/* Marzban Users List */
.mz-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 15px; margin-bottom: 15px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; transition: 0.3s; }
.mz-card:hover { border-color: var(--primary); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.mz-col-user { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; }
.mz-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.mz-name { font-weight: 800; font-size: 1rem; color: var(--text); }
.mz-col-status { flex: 1; min-width: 120px; text-align: center; }
.mz-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; margin-bottom: 5px; }
.mz-expire { font-size: 0.75rem; opacity: 0.7; }
.mz-col-usage { flex: 2; min-width: 200px; }
.mz-usage-text { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: bold; margin-bottom: 5px; opacity: 0.9; }
.mz-progress-bg { width: 100%; height: 6px; background: rgba(0,0,0,0.06); border-radius: 10px; overflow: hidden; }
.dark-mode .mz-progress-bg { background: rgba(255,255,255,0.1); }
.mz-progress-bar { height: 100%; border-radius: 10px; transition: 0.4s; }
.mz-col-actions { display: flex; gap: 8px; }
.mz-btn { width: 35px; height: 35px; border-radius: 8px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem; background: rgba(0,0,0,0.04); color: var(--text); transition: 0.2s; }
.dark-mode .mz-btn { background: rgba(255,255,255,0.08); }
.mz-btn:hover { color: white !important; transform: scale(1.05); }

/* History Page Styles */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 1.2rem; font-weight: 900; color: var(--text); display: flex; align-items: center; gap: 8px; margin: 0; }
.history-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 15px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px; transition: 0.3s; }
.history-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.h-col-info { flex: 2; min-width: 200px; display: flex; flex-direction: column; gap: 5px; }
.h-target { font-weight: 900; font-size: 1rem; color: var(--text); }
.h-desc { font-size: 0.8rem; color: var(--text); opacity: 0.7; }
.h-col-date { flex: 1; min-width: 130px; font-size: 0.8rem; color: var(--text); opacity: 0.8; font-weight: bold; }
.h-col-amount { flex: 1; min-width: 120px; text-align: left; font-size: 1.1rem; font-weight: 900; direction: ltr; }
.amt-positive { color: #10b981; }
.amt-negative { color: #ef4444; }
.h-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: bold; margin-left: 8px; }

/* Login Pages Styles */
.login-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background-color: var(--bg); margin: 0; font-family: inherit; }
.login-wrapper { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; z-index: 10; }
.login-brand { font-size: 2.5rem; font-weight: 900; color: var(--primary); letter-spacing: 2px; margin-bottom: 5px; text-shadow: 0 4px 15px rgba(239, 68, 68, 0.2); line-height: 1; }
.reseller-theme .login-brand { color: #3b82f6; text-shadow: 0 4px 15px rgba(59, 130, 246, 0.2); }
.login-subtitle-top { color: var(--text); opacity: 0.6; font-size: 0.95rem; margin-bottom: 30px; font-weight: 800; }
.login-card { width: 100%; background: var(--card); padding: 40px 30px; border-radius: 20px; box-shadow: 0 15px 35px rgba(0,0,0,0.06); border: 1px solid var(--border); box-sizing: border-box; }
.login-card .form-group { text-align: right; margin-bottom: 20px; }
.login-card .form-label { font-size: 0.85rem; font-weight: bold; margin-bottom: 8px; display: block; color: var(--text); opacity: 0.8; }
.login-card .form-control { width: 100%; padding: 14px 15px; font-size: 0.95rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; transition: 0.3s; box-sizing: border-box; }
.login-card .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }
.reseller-theme .login-card .form-control:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); }
.login-card .btn-main { width: 100%; padding: 14px; font-size: 1.1rem; border-radius: 12px; margin-top: 10px; box-shadow: 0 5px 15px rgba(239, 68, 68, 0.2); transition: 0.3s; cursor: pointer; }
.login-card .btn-main:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3); }
.reseller-theme .login-card .btn-main { background: #3b82f6; box-shadow: 0 5px 15px rgba(59, 130, 246, 0.2); }
.reseller-theme .login-card .btn-main:hover { box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3); }
.login-footer { margin-top: 25px; font-size: 0.85rem; }
.login-footer a { color: var(--text); opacity: 0.6; text-decoration: none; font-weight: bold; transition: 0.2s; }
.login-footer a:hover { opacity: 1; color: var(--primary); }
.reseller-theme .login-footer a:hover { color: #3b82f6; }

/* Dashboard Header */
.dashboard-header { background: linear-gradient(135deg, var(--primary) 0%, #f43f5e 100%); color: white; padding: 25px; border-radius: 15px; margin-bottom: 25px; box-shadow: 0 8px 20px -5px rgba(239, 68, 68, 0.3); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; text-align: right; }
.dashboard-header h1 { margin: 0; font-size: 1.5rem; font-weight: 900; }
.dashboard-header p { margin: 5px 0 0 0; opacity: 0.9; font-size: 0.9rem; }
.date-badge { background: rgba(255,255,255,0.2); padding: 8px 15px; border-radius: 10px; font-weight: bold; font-size: 0.85rem; backdrop-filter: blur(5px); }

/* =========================================
   Utility Classes 
========================================= */
.mt-4 { margin-top: 1.5rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.flex-1-5 { flex: 1.5 !important; }
.text-left { text-align: left !important; direction: ltr !important; }
.font-black { font-weight: 900 !important; }
.text-xl { font-size: 1.1rem !important; }
.text-lg { font-size: 1rem !important; }
.text-primary { color: var(--primary) !important; }

/* Collapse Forms */
.form-collapse { display: none; width: 100%; border-top: 1px dashed var(--border); padding-top: 15px; margin-top: 5px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; width: 100%; }
.form-col-1 { flex: 1; min-width: 120px; }
.form-col-2 { flex: 2; min-width: 200px; }

/* Buttons & Specific elements */
.btn-auto-pill { width: auto; margin-bottom: 20px; border-radius: 30px; padding: 12px 25px; }
.btn-w-150 { width: 150px; margin: 0; }
.btn-gray { background-color: #6b7280 !important; }
.btn-blue { background-color: #3b82f6 !important; }
.btn-green { background-color: #10b981 !important; }
.card-bordered { border: 2px solid var(--primary); }
.flex-actions { display: flex; gap: 10px; margin-top: 15px; }
.flex-end { display: flex; align-items: flex-end; }

/* Toast Notifications */
.g-toast { position: fixed; bottom: 25px; right: 25px; background: var(--card); color: var(--text); padding: 12px 25px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border-right: 4px solid var(--primary); transform: translateX(150%); transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); z-index: 9999; font-weight: bold; font-size: 0.9rem; border-left: 1px solid var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.g-toast.show { transform: translateX(0); }
.g-toast-success { border-right-color: #10b981; }
.g-toast-danger { border-right-color: #ef4444; }

/* Minimal Inputs & Modals */
.input-minimal::-webkit-inner-spin-button, .input-minimal::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-minimal { -moz-appearance: textfield; text-align: center; font-weight: bold; letter-spacing: 2px; font-size: 1.1rem !important; }
.custom-modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); backdrop-filter: blur(5px); }
.modal-content { background: var(--card); margin: 6% auto; padding: 25px; border-radius: 20px; width: 90%; max-width: 450px; border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0,0,0,0.5); position: relative; padding-top: 45px; }
.close-modal { position: absolute; top: 15px; left: 20px; color: var(--text); font-size: 28px; font-weight: bold; cursor: pointer; transition: 0.3s; line-height: 1; z-index: 10; opacity: 0.7; }
.close-modal:hover { color: #ef4444; opacity: 1; }
.qr-box { text-align: center; margin-top: 15px; }
.qr-box img { max-width: 250px; border-radius: 10px; background: white; padding: 10px; border: 1px solid #ddd; }

/* =========================================
   Advanced Filter Bar (One Line on Desktop)
========================================= */
.filter-wrapper { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.filter-form { display: flex; gap: 10px; align-items: center; width: 100%; flex-wrap: nowrap; }
.filter-input { flex: 2; min-width: 150px; margin: 0; }
.filter-select { flex: 1; min-width: 130px; margin: 0; }
.filter-limit { flex: 0 1 90px; margin: 0; }
.filter-btn { width: auto !important; padding: 0 25px; margin: 0; white-space: nowrap; height: 38px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-group-copy { width: auto; height: 35px; padding: 0 15px; margin: 0; font-size: 0.8rem; flex-shrink: 0; display: flex; align-items: center; }

/* =========================================
   Desktop Overrides 
========================================= */
@media (min-width: 900px) {
    .grid-create { grid-template-columns: 1.5fr 1fr 1fr; }
    .btn-main.w-auto { width: 150px; margin: 15px auto 0 auto; display: block; }
}

/* =========================================
   Mobile Responsiveness (واکنش‌گرایی کامل)
========================================= */
@media (max-width: 992px) {
    /* تنظیمات نوار فیلتر در موبایل و تبلت */
    .filter-form { flex-wrap: wrap; }
    .filter-input { flex: 1 1 100%; order: 1; }
    .filter-select { flex: 1 1 calc(50% - 5px); order: 2; }
    .filter-limit { flex: 1 1 calc(50% - 5px); order: 3; }
    .filter-btn { flex: 1 1 100%; order: 4; width: 100% !important; margin-top: 5px; }
    
    /* تنظیمات فرم ساخت کاربر در موبایل */
    .form-row { flex-direction: column; align-items: stretch; gap: 5px; }
    .form-col-1, .form-col-2 { width: 100%; min-width: 100%; }
    .btn-auto-pill { width: 100% !important; margin-top: 10px; }
    .grid-create { grid-template-columns: 1fr; align-items: stretch !important; }

    /* سایر بخش‌ها */
    .mz-card { flex-direction: column; align-items: stretch; }
    .mz-col-status { text-align: right; }
    .mz-col-actions { justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 10px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .history-card { flex-direction: column; align-items: flex-start; }
    .h-col-amount { width: 100%; text-align: right; direction: rtl; border-top: 1px dashed var(--border); padding-top: 10px; }
    .dashboard-header { flex-direction: column; text-align: center; justify-content: center; }
}

/* =========================================
   Smart Grid Form Layout (Mobile & Desktop)
========================================= */
/* در دسکتاپ 2 ستون، فاصله مرتب */
.smart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 15px; }
.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-size: 0.85rem; font-weight: bold; color: var(--text); opacity: 0.9; margin: 0; }
.input-flex { display: flex; gap: 8px; align-items: stretch; }
.input-flex > input { flex: 2; width: 100%; margin: 0; height: 40px; box-sizing: border-box; }
.input-flex > select, .input-flex > button { flex: 1; min-width: 90px; margin: 0; height: 40px; box-sizing: border-box; }

/* باکس سوئیچ گروهی مینیمال */
.bulk-toggle-card { background: rgba(0,0,0,0.02); border: 1px solid var(--border); border-radius: 10px; padding: 12px 15px; margin-top: 15px; cursor: pointer; transition: 0.2s; }
.bulk-toggle-card:hover { border-color: var(--primary); background: rgba(0,0,0,0.04); }
.bulk-header { display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; font-weight: bold; color: var(--text); }
.dark-mode .bulk-toggle-card { background: rgba(255,255,255,0.02); }
.dark-mode .bulk-toggle-card:hover { background: rgba(255,255,255,0.05); }

/* واکنش‌گرایی موبایل: تمام آیتم‌ها در یک خط زیر هم */
@media (max-width: 768px) {
    .smart-grid { grid-template-columns: 1fr; gap: 15px; }
    .input-flex { flex-direction: row; } /* در موبایل هم اینپوت و دکمه کنار هم می‌مانند اما کل باکس یک خط می‌گیرد */
}

/* =========================================
   Advanced Filter Bar 
========================================= */
.filter-wrapper { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.filter-form { display: flex; gap: 10px; align-items: center; width: 100%; flex-wrap: nowrap; }
.filter-input { flex: 2; min-width: 150px; margin: 0; height: 40px; }
.filter-select { flex: 1; min-width: 130px; margin: 0; height: 40px; }
.filter-limit { flex: 0 1 90px; margin: 0; height: 40px; }
.filter-btn { width: auto !important; padding: 0 25px; margin: 0; white-space: nowrap; height: 40px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

@media (max-width: 992px) {
    .filter-form { flex-wrap: wrap; }
    .filter-input { flex: 1 1 100%; order: 1; }
    .filter-select { flex: 1 1 calc(50% - 5px); order: 2; }
    .filter-limit { flex: 1 1 calc(50% - 5px); order: 3; }
    .filter-btn { flex: 1 1 100%; order: 4; width: 100% !important; margin-top: 5px; }
}
