/* وارد کردن فونت وزیر */


/* ریست و تنظیمات پایه */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn FD', 'Tahoma', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    color: #333;
    line-height: 1.6;
}

/* متغیرهای CSS */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #3730a3;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* صفحه ورود */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 30px;
    text-align: center;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.login-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* دکمه‌ها */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn i {
    font-size: 16px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-warning:hover {
    background: #d97706;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* هشدارها */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* داشبورد */
.dashboard {
    min-height: 100vh;
    background: #f1f5f9;
}

/* هدر */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.header-left h1 {
    color: var(--dark-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.header-left i {
    color: var(--primary-color);
    margin-left: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.welcome-text {
    color: #64748b;
    font-weight: 500;
}

/* آمار */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border-right: 4px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.active {
    border-right-color: var(--success-color);
}

.stat-card.inactive {
    border-right-color: var(--danger-color);
}

.stat-card.used {
    border-right-color: var(--info-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    background: var(--primary-color);
}

.stat-card.active .stat-icon {
    background: var(--success-color);
}

.stat-card.inactive .stat-icon {
    background: var(--danger-color);
}

.stat-card.used .stat-icon {
    background: var(--info-color);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.stat-content p {
    color: #64748b;
    font-weight: 500;
}

/* کنترل‌ها */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px 20px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 20px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-group input,
.search-group select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    font-family: 'Vazirmatn FD', 'Tahoma', sans-serif;
}

.search-group input {
    width: 300px;
}

.search-group input:focus,
.search-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* جدول */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin: 0 30px;
    max-width: 1340px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    max-height: 100% !important;
}

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

.licenses-table thead {
    background: #f8fafc;
}

.licenses-table th,
.licenses-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.licenses-table th {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 14px;
}

.licenses-table td {
    font-size: 14px;
    color: #475569;
}

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

.licenses-table tbody tr:hover {
    background: #f8fafc;
}

.license-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.machine-guid {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #64748b;
    max-width: 200px;
    overflow: hidden;
    
    white-space: nowrap;
}

.licenses-table td:nth-child(3),
.licenses-table td:nth-child(4) {
    min-width: 180px;
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
}

.licenses-table th:nth-child(3),
.licenses-table th:nth-child(4) {
    min-width: 180px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background: #fef2f2;
    color: #991b1b;
}

.actions {
    display: flex;
    gap: 8px;
}

/* اطلاعات صفحه‌بندی */
.pagination-info {
text-align: center;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  background: #e2e2e2;
  max-width: 200px;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 20px;
  padding-top: 0px;
  border-radius: 8px;
}

/* صفحه‌بندی */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 30px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    background: white;
    color: #64748b;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    font-weight: 500;
}

.page-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* مودال */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header h3 {
    color: var(--dark-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--danger-color);
}

.modal form {
    padding: 25px;
}

.modal .form-group {
    margin-bottom: 20px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.modal input,
.modal textarea,
.modal select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* انیمیشن‌ها */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* لودینگ */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* نوتیفیکیشن مدرن */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1001;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 0;
    display: flex;
    flex-direction: column;
    min-width: 320px;
    max-width: 400px;
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.toast.success .toast-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.toast.error .toast-header {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.toast.warning .toast-header {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.toast.info .toast-header {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 16px 16px;
    transition: width linear;
    z-index: 1;
}

.toast.success .toast-progress {
    background: rgba(255, 255, 255, 0.4);
}

.toast.error .toast-progress {
    background: rgba(255, 255, 255, 0.4);
}

.toast.warning .toast-progress {
    background: rgba(255, 255, 255, 0.4);
}

.toast.info .toast-progress {
    background: rgba(255, 255, 255, 0.4);
}

/* دیالوگ تأیید مدرن */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.confirm-dialog.show {
    display: flex;
}

.confirm-dialog-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUpBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.confirm-dialog-header {
    padding: 24px 24px 16px;
    text-align: center;
}

.confirm-dialog-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.confirm-dialog-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.confirm-dialog-icon.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.confirm-dialog-icon.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.confirm-dialog-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.confirm-dialog-message {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    padding: 0 8px;
}

.confirm-dialog-actions {
    padding: 20px 24px 24px;
    display: flex;
    gap: 12px;
}

.confirm-dialog-actions .btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.confirm-dialog-actions .btn-secondary {
    background: #f1f5f9;
    color: #64748b;
}

.confirm-dialog-actions .btn-secondary:hover {
    background: #e2e8f0;
}

.confirm-dialog-actions .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.confirm-dialog-actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.confirm-dialog-actions .btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.confirm-dialog-actions .btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* لودینگ مدرن */
.modern-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0; }

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideUpBounce {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* انیمیشن‌های اضافی */
.pulse-animation {
    animation: pulse 2s infinite;
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* بهبود مودال موجود */
.modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 20px 20px 0 0;
}

/* نوتیفیکیشن قدیمی - حذف شده */
.notification {
    display: none !important;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 0 20px 20px;
    }
    
    .search-group {
        flex-direction: column;
    }
    
    .search-group input {
        width: 100%;
    }
    
    .table-container {
        margin: 0 20px;
        overflow-x: auto;
    }
    
    .licenses-table {
        min-width: 800px;
    }
    
    .modal-content {
        margin: 20px;
    }
    
    .actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }
    
    .login-form {
        padding: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .licenses-table th,
    .licenses-table td {
        padding: 10px;
        font-size: 12px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 11px;
    }
}