body {
    background-color: #f3f4f6;
    min-height: 100vh;
    color: #1f2937;
}

/* Navigation */
.navbar {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-brand svg {
    width: 32px;
    height: 32px;
    color: #2563eb;
}

.navbar-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.navbar-nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.active {
    background: #eff6ff;
    color: #2563eb;
}

.nav-btn:not(.active) {
    background: transparent;
    color: #6b7280;
}

.nav-btn:hover:not(.active) {
    background: #f3f4f6;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    display: none;
}

/* Page Container */
.page {
    display: none;
}

.page.active {
    display: block;
}

.container-pattern-start {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

.container-sm {
    max-width: 900px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
}

.page-subtitle {
    color: #6b7280;
    margin-top: 4px;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #f9fafb;
}

.btn svg {
    width: 20px;
    height: 20px;
}

/* Cards */
.card-pattern-start {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.card-body {
    padding: 24px;
}

/* Search & Filter */
.filter-section {
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #9ca3af;
}

.search-box input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select {
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    background: #ffffff;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
}

.table th {
    padding: 16px 20px;
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.table tbody tr {
    transition: background 0.3s ease;
}

.table tbody tr:hover {
    background: #f0f7ff;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-green {
    background: #dcfce7;
    color: #15803d;
}

.badge-red {
    background: #fee2e2;
    color: #b91c1c;
}

/* Variable Tags */
.variable-tag {
    display: inline-block;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 2px;
}

.variables-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.action-btn.view-pattern {
    background: #eff6ff;
    color: #2563eb;
}

.action-btn.view-pattern:hover {
    background: #dbeafe;
}

.action-btn.edit-pattern {
    background: #fef9c3;
    color: #ca8a04;
}

.action-btn.edit-pattern:hover {
    background: #fef08a;
}

.action-btn.delete-pattern {
    background: #fee2e2;
    color: #dc2626;
}

.action-btn.delete-pattern:hover {
    background: #fecaca;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    color: #6b7280;
    font-size: 0.9rem;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.page-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.page-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.page-btn svg {
    width: 20px;
    height: 20px;
}

/* Mobile Cards */
.mobile-cards {
    display: none;
}

.pattern-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.pattern-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.pattern-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.pattern-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.pattern-card-code {
    font-size: 0.85rem;
    color: #6b7280;
    font-family: monospace;
    margin-top: 4px;
}

.pattern-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.pattern-card-label {
    color: #6b7280;
    font-size: 0.9rem;
}

.pattern-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.pattern-card-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.pattern-card-btn svg {
    width: 16px;
    height: 16px;
}

.pattern-card-btn.view {
    background: #eff6ff;
    color: #2563eb;
}

.pattern-card-btn.edit {
    background: #fef9c3;
    color: #ca8a04;
}

.pattern-card-btn.delete {
    background: #fee2e2;
    color: #dc2626;
    flex: 0;
    padding: 10px 14px;
}

/* Form Styles */
.form-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.form-icon {
    width: 56px;
    height: 56px;
    background: #eff6ff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-icon svg {
    width: 28px;
    height: 28px;
    color: #2563eb;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.form-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin-top: 2px;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 500;
    color: #374151;
}

.form-label svg {
    width: 20px;
    height: 20px;
    color: #2563eb;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Vazirmatn', sans-serif;
}

.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

textarea.form-control {
    resize: none;
    min-height: 120px;
}

/* Variables Section */
.variables-section {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    background: #f9fafb;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 44px;
    margin-bottom: 16px;
}

.variable-item {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.variable-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.variable-item span {
    font-size: 0.9rem;
}

.variable-type {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.variable-remove {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    transition: background 0.3s ease;
}

.variable-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

.variable-remove svg {
    width: 16px;
    height: 16px;
}

.no-variables {
    color: #9ca3af;
    font-size: 0.9rem;
}

.add-variable-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #eff6ff;
    color: #2563eb;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-variable-btn:hover {
    background: #dbeafe;
}

.add-variable-btn svg {
    width: 18px;
    height: 18px;
}

/* Textarea with counter */
.textarea-wrapper {
    position: relative;
}

.char-counter {
    position: absolute;
    left: 14px;
    bottom: 14px;
    font-size: 0.85rem;
    color: #9ca3af;
}

.form-hint {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Checkbox Options */
.options-section {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #374151;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #2563eb;
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    animation: modalFadeIn 0.3s ease;
}

.modal-lg {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2937;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-close svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #f3f4f6;
}

.modal-footer .btn {
    flex: 1;
}

/* Details Modal */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
}

.detail-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 6px;
}

.detail-value {
    font-weight: 600;
    color: #1f2937;
}

.detail-full {
    grid-column: 1 / -1;
}

.detail-text-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.detail-text-label {
    font-size: 0.9rem;
    color: #2563eb;
    font-weight: 500;
    margin-bottom: 8px;
}

.detail-text-content {
    color: #1f2937;
    white-space: pre-wrap;
    line-height: 1.7;
}

.detail-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 300;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.toast svg {
    width: 20px;
    height: 20px;
}

/* Shared Icon */
.shared-icon {
    display: flex;
    justify-content: center;
}

.shared-icon svg {
    width: 22px;
    height: 22px;
}

.shared-icon.yes svg {
    color: #10b981;
}

.shared-icon.no svg {
    color: #d1d5db;
}
span.pending {
    background: #d0e4ff;
    color: black;
    margin: 6px;
    font-size: 11px;
}
.update_pattern--now{
    background: linear-gradient(135deg, #f11d33, #f11d33ad);
    text-decoration: none;
}
.update_pattern--now:hover{
    background: linear-gradient(135deg, #f11d33, #f11d33ad) !important;
    transform: translateY(-2px);
    box-shadow: unset !important;
    color: white !important;
}
tr.is-loading {
    filter: blur(2px);
}
/* Responsive */
@media (max-width: 1024px) {
    .table-container {
        display: none;
    }

    .mobile-cards {
        display: block;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        padding: 0 16px;
    }

    .nav-btn span {
        display: none;
    }

    .nav-btn svg {
        display: block;
    }

    .nav-btn {
        padding: 10px;
    }

    .container-pattern-start {
        padding: 20px 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .btn {
        width: 100%;
    }

    .filter-row {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        justify-content: center;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .navbar-brand h1 {
        font-size: 1rem;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .pattern-card-actions {
        flex-wrap: wrap;
    }

    .pattern-card-btn {
        flex: 1 1 45%;
    }
}

/* Pattern Form Button Loader */
#patternForm button[type="submit"].loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

#patternForm button[type="submit"].loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: pattern-form-spin 0.8s linear infinite;
}

#patternForm button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes pattern-form-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}