/* ===== استایل‌های بخش بیمه‌های طرف قرارداد ===== */

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

body {
    font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 15px;
    color: #2c3e50;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 25px;
}

/* ===== هدر ===== */
.main-header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.main-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.05), transparent 60%);
    pointer-events: none;
}
.main-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
}
.main-header p {
    opacity: 0.9;
    font-size: 14px;
    position: relative;
    z-index: 1;
}
.back-link {
    display: inline-block;
    color: #ffd700;
    text-decoration: none;
    margin-top: 8px;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 1;
}
.back-link:hover {
    text-decoration: underline;
}

/* ===== نوار مدیریت ===== */
.admin-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-bar .admin-info {
    font-size: 13px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
}
.admin-bar .admin-info .admin-name {
    color: #3498db;
    font-weight: bold;
}
.admin-bar .admin-info .role-badge {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 20px;
    background: #ffc107;
    color: #856404;
    font-weight: 600;
}
.admin-bar .logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}
.admin-bar .logout-btn:hover {
    background: #c82333;
}

/* ===== دکمه‌ها ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: Tahoma;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.btn-primary {
    background: #3498db;
    color: white;
}
.btn-primary:hover {
    background: #2980b9;
}
.btn-success {
    background: #28a745;
    color: white;
}
.btn-success:hover {
    background: #218838;
}
.btn-danger {
    background: #dc3545;
    color: white;
}
.btn-danger:hover {
    background: #c82333;
}
.btn-warning {
    background: #ffc107;
    color: #2c3e50;
}
.btn-warning:hover {
    background: #e0a800;
}
.btn-secondary {
    background: #95a5a6;
    color: white;
}
.btn-secondary:hover {
    background: #7f8c8d;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.btn-block {
    width: 100%;
    justify-content: center;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== فرم‌ها ===== */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}
.form-group label .required {
    color: #dc3545;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: Tahoma;
    font-size: 15px;
    transition: border 0.3s;
    box-sizing: border-box;
}
.form-control:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}
textarea.form-control {
    min-height: 80px;
    resize: vertical;
}
select.form-control {
    appearance: auto;
}
.file-upload-wrapper {
    position: relative;
    width: 100%;
}
.file-upload-wrapper .file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.file-upload-wrapper .file-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 50px;
}
.file-upload-wrapper .file-label:hover {
    border-color: #3498db;
    background: #eaf4fb;
}
.file-upload-wrapper .file-label .file-name {
    font-size: 13px;
    color: #7f8c8d;
}
.file-upload-wrapper .file-preview {
    margin-top: 10px;
    max-width: 120px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 5px;
    background: #f8f9fa;
}
.file-upload-wrapper .file-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* ===== پیام‌ها ===== */
.notification {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
    font-weight: 600;
    font-size: 14px;
}
.notification.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.notification.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.notification.info {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
.notification.warning {
    display: block;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

/* ===== مودال ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    animation: modalSlide 0.3s ease;
}
@keyframes modalSlide {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}
.modal-content h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}
.modal-content .btn-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.modal-content .btn-row .btn {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}
.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
}
.empty-state h3 {
    color: #2c3e50;
    margin-bottom: 8px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   نمایش بیمه‌ها (کارت‌های گرافیکی با افکت)
   ========================================================= */
.insurance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin: 20px 0;
}
.insurance-card {
    background: white;
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
    cursor: default;
}
.insurance-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05), rgba(46, 204, 113, 0.05));
    opacity: 0;
    transition: opacity 0.4s ease;
}
.insurance-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 35px rgba(52, 152, 219, 0.15);
    border-color: #3498db;
}
.insurance-card:hover::before {
    opacity: 1;
}
.insurance-card .logo-wrapper {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}
.insurance-card .logo-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}
.insurance-card:hover .logo-wrapper img {
    transform: scale(1.05);
}
.insurance-card .insurance-name {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}
.insurance-card .insurance-desc {
    font-size: 12px;
    color: #7f8c8d;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}
.insurance-card .card-shine {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.03) 50%, transparent 70%);
    transform: rotate(25deg) translateX(-100%);
    transition: transform 0.8s ease;
    pointer-events: none;
}
.insurance-card:hover .card-shine {
    transform: rotate(25deg) translateX(50%);
}

/* افکت ورود کارت‌ها */
.insurance-card {
    animation: cardFadeIn 0.6s ease backwards;
}
.insurance-card:nth-child(1) { animation-delay: 0.05s; }
.insurance-card:nth-child(2) { animation-delay: 0.10s; }
.insurance-card:nth-child(3) { animation-delay: 0.15s; }
.insurance-card:nth-child(4) { animation-delay: 0.20s; }
.insurance-card:nth-child(5) { animation-delay: 0.25s; }
.insurance-card:nth-child(6) { animation-delay: 0.30s; }
.insurance-card:nth-child(7) { animation-delay: 0.35s; }
.insurance-card:nth-child(8) { animation-delay: 0.40s; }
.insurance-card:nth-child(9) { animation-delay: 0.45s; }
.insurance-card:nth-child(10) { animation-delay: 0.50s; }
.insurance-card:nth-child(11) { animation-delay: 0.55s; }
.insurance-card:nth-child(12) { animation-delay: 0.60s; }
.insurance-card:nth-child(13) { animation-delay: 0.65s; }
.insurance-card:nth-child(14) { animation-delay: 0.70s; }
.insurance-card:nth-child(15) { animation-delay: 0.75s; }
.insurance-card:nth-child(16) { animation-delay: 0.80s; }
.insurance-card:nth-child(17) { animation-delay: 0.85s; }
.insurance-card:nth-child(18) { animation-delay: 0.90s; }
.insurance-card:nth-child(19) { animation-delay: 0.95s; }
.insurance-card:nth-child(20) { animation-delay: 1.00s; }

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== جدول مدیریت ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -5px;
    padding: 0 5px;
}
.insurance-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 13px;
}
.insurance-table th {
    background: #f1f3f5;
    padding: 10px 8px;
    text-align: center;
    border-bottom: 2px solid #dee2e6;
    font-weight: 700;
    color: #2c3e50;
    white-space: nowrap;
}
.insurance-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}
.insurance-table .logo-thumb {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    padding: 3px;
    background: #f8f9fa;
}
.insurance-table .badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}
.insurance-table .badge.active {
    background: #d4edda;
    color: #155724;
}
.insurance-table .badge.inactive {
    background: #f8d7da;
    color: #721c24;
}
.insurance-table .actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}
.insurance-table .actions .btn {
    padding: 3px 8px;
    font-size: 11px;
    min-width: 30px;
}

/* ===== ریسپانسیو ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    .main-header h1 {
        font-size: 20px;
    }
    .main-header p {
        font-size: 13px;
    }
    .admin-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .insurance-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 14px;
    }
    .insurance-card {
        padding: 15px 10px;
    }
    .insurance-card .logo-wrapper {
        height: 80px;
    }
    .insurance-card .insurance-name {
        font-size: 13px;
    }
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
    .modal-content .btn-row {
        flex-direction: column;
    }
    .modal-content .btn-row .btn {
        width: 100%;
    }
    .insurance-table {
        font-size: 12px;
        min-width: 500px;
    }
    .insurance-table th,
    .insurance-table td {
        padding: 7px 5px;
    }
    .insurance-table .logo-thumb {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    .container {
        padding: 10px;
        border-radius: 10px;
    }
    .main-header {
        padding: 15px;
    }
    .main-header h1 {
        font-size: 17px;
    }
    .insurance-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }
    .insurance-card {
        padding: 12px 8px;
        border-radius: 12px;
    }
    .insurance-card .logo-wrapper {
        height: 60px;
    }
    .insurance-card .insurance-name {
        font-size: 12px;
    }
    .insurance-card .insurance-desc {
        font-size: 10px;
    }
    .insurance-table {
        font-size: 11px;
        min-width: 400px;
    }
    .insurance-table th,
    .insurance-table td {
        padding: 5px 3px;
    }
    .insurance-table .logo-thumb {
        width: 32px;
        height: 32px;
    }
    .btn {
        font-size: 13px;
        padding: 8px 14px;
    }
    .btn-sm {
        font-size: 10px;
        padding: 3px 8px;
    }
    .file-upload-wrapper .file-label {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 40px;
    }
}

@media (max-width: 360px) {
    .insurance-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }
    .insurance-card .logo-wrapper {
        height: 50px;
    }
    .insurance-card .insurance-name {
        font-size: 11px;
    }
    .insurance-table {
        min-width: 340px;
        font-size: 10px;
    }
    .insurance-table th,
    .insurance-table td {
        padding: 4px 2px;
    }
}