/**
 * cases.css — Styles for case form wizard, case list, and case detail pages.
 *
 * Uses the same Saudi green design system from base.css and ported from old styles.css.
 */

/* --- Layout --- */

.case-page {
    min-height: 100vh;
    background: var(--bg-page);
    direction: rtl;
}

body[dir="ltr"] .case-page {
    direction: ltr;
}

/* --- Case Header --- */

.case-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 16px 0;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
}

.header-logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-titles .title-ar {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.header-titles .title-en {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

body[dir="ltr"] .header-titles .title-ar {
    display: none;
}

body[dir="ltr"] .header-titles .title-en {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-nav .header-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.header-nav .header-link:hover {
    background: var(--bg-section);
    color: var(--primary);
}

.user-info {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.lang-selector-header {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 8px 14px;
    padding-left: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-ar), var(--font-en), 'Segoe UI Emoji', 'Noto Color Emoji', Arial, sans-serif;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    min-width: 130px;
    transition: background-color 0.2s;
}

body[dir="ltr"] .lang-selector-header {
    background-position: right 12px center;
    padding-left: 14px;
    padding-right: 32px;
}

.lang-selector-header:hover {
    background-color: var(--primary-hover);
}

.lang-selector-header option {
    background: var(--white);
    color: var(--text-primary);
    font-family: var(--font-ar), var(--font-en), 'Segoe UI Emoji', 'Noto Color Emoji', Arial, sans-serif;
}

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

/* --- New Case Intro (Method Selection) --- */

.new-case-intro {
    max-width: 800px;
    margin: 48px auto;
    padding: 0 24px;
    text-align: center;
}

.new-case-intro-header {
    margin-bottom: 36px;
}

.new-case-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.new-case-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

.method-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 680px;
    margin: 0 auto;
}

.method-card {
    background: var(--white);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 32px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
}

.method-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 107, 60, 0.12);
}

.method-icon {
    font-size: 2.5rem;
    margin-bottom: 14px;
    display: block;
}

.method-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.method-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.method-tag {
    display: inline-block;
    margin-top: 12px;
    background: var(--primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.method-back-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    transition: color 0.2s;
}

.method-back-btn:hover {
    color: var(--primary);
}

/* --- Contract Upload Section --- */

.contract-upload-section {
    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px;
}

.upload-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 40px 32px;
    text-align: center;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.upload-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.upload-card h3 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.upload-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.upload-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.upload-btn {
    cursor: pointer;
    display: inline-block;
}

.upload-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 16px;
}

.upload-status {
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-section);
    border-radius: 6px;
}

.loading-spinner {
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.upload-status p {
    color: var(--primary);
    font-weight: 600;
    margin: 0;
}

/* --- Progress Bar --- */

.wizard-progress {
    background: var(--bg-card);
    padding: 24px 40px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0;
}

.progress-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0;
}

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 16px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    background: var(--border-light);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: var(--primary);
    color: var(--white);
}

.progress-step.completed .step-number {
    background: var(--success);
    color: var(--white);
}

.step-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    transition: color 0.2s;
}

.progress-step.active .step-label {
    color: var(--primary);
}

.progress-step.completed .step-label {
    color: var(--success);
}

.progress-line {
    flex: 1;
    height: 2px;
    background: var(--border-light);
    margin: 0 8px;
    margin-bottom: 24px;
}

.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width 0.4s ease;
}

/* --- Form Container --- */

.form-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* --- Wizard Steps --- */

.wizard-step {
    display: none;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border-light);
}

.wizard-step.active {
    display: block;
}

/* Step Header */
.step-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.step-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.step-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

.step-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.step-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

/* --- Form Sections --- */

.form-section {
    margin-bottom: 24px;
    padding: 24px;
    background: var(--bg-section);
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

/* --- Form Rows --- */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* --- Radio Buttons --- */

.radio-row {
    display: flex;
    gap: 24px;
    padding: 8px 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

/* --- Conditional Fields --- */

.conditional-field,
.conditional-section {
    transition: all 0.3s ease;
}

.conditional-section {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 24px;
    margin-top: 16px;
    border: 1px solid var(--border-light);
}

/* --- Info Box --- */

.info-box {
    background: #EBF8FF;
    border: 1px solid #4299E1;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    color: var(--info);
    font-size: 0.95rem;
}

/* --- Claim Type Selector --- */

.claim-type-selector-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.claim-type-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.claim-type-option {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-default);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    user-select: none;
}

.claim-type-option:hover {
    border-color: var(--primary);
    background: var(--bg-section);
}

/* Clear active state when checkbox is checked */
.claim-type-option:has(input[type="checkbox"]:checked) {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    box-shadow: 0 0 0 1px var(--primary);
}

.claim-type-option input[type="checkbox"] {
    margin-left: 14px;
    margin-right: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

body[dir="ltr"] .claim-type-option input[type="checkbox"] {
    margin-left: 0;
    margin-right: 14px;
}

.claim-type-option span {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.claim-type-option input[type="checkbox"]:checked + span {
    color: var(--primary);
}

.claim-type-label {
    font-size: 0.95rem;
}

/* --- Claim Sections --- */

.claim-section {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

/* Give each claim section a subtle left accent so they look distinct side by side */
#wagesSection  { border-right: 4px solid #1a7f4f; }
#eosSection    { border-right: 4px solid #1565c0; }
#leaveSection  { border-right: 4px solid #6a1b9a; }

body[dir="ltr"] #wagesSection  { border-right: none; border-left: 4px solid #1a7f4f; }
body[dir="ltr"] #eosSection    { border-right: none; border-left: 4px solid #1565c0; }
body[dir="ltr"] #leaveSection  { border-right: none; border-left: 4px solid #6a1b9a; }

.claim-total {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 2px solid var(--border-light);
    font-size: 1rem;
    text-align: left;
}

/* --- Dynamic Claim Row (Salary / Leave Items) --- */

.claim-row,
.salary-claim-item,
.vacation-year-item {
    background: var(--bg-section);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.claim-row-header,
.claim-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.claim-row-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary);
}

.claim-item-header h4 {
    margin: 0;
    color: var(--primary);
    font-size: 16px;
}

.claim-row-remove,
.remove-claim-btn {
    background: var(--error);
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background-color 0.2s;
}

.claim-row-remove:hover,
.remove-claim-btn:hover {
    background: #9B2C2C;
}

.claim-row .form-row {
    gap: 12px;
}

.claim-row .form-group {
    margin-bottom: 12px;
}

/* --- Calculated and Total Amount Displays --- */

.calculated-amount {
    background: var(--bg-section);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    text-align: center;
}

.calculated-amount strong {
    color: var(--primary);
    font-size: 15px;
}

.calculated-amount span {
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
}

.total-amount-display {
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 12px;
    margin: 16px 0;
    text-align: center;
}

.total-amount-display strong,
.total-amount-display span {
    color: var(--white);
    font-size: 15px;
}

.total-amount-display span {
    font-size: 18px;
    font-weight: 700;
}

/* --- Calculation Display (EOS) --- */

.calculation-display {
    background: var(--bg-section);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 16px;
    margin: 12px 0;
}

.calculation-display h4 {
    color: var(--primary);
    margin-bottom: 8px;
}

.service-duration {
    font-size: 15px;
    line-height: 1.8;
}

.service-duration span {
    font-weight: 600;
    color: var(--primary);
}

/* --- Attachments Section --- */

.attachments-info {
    background: var(--bg-section);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.attachments-info p {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 15px;
}

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.attachment-list li {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg-card);
    border-radius: 4px;
    transition: background-color 0.2s;
    position: relative;
    padding-right: 32px;
}

body[dir="ltr"] .attachment-list li {
    padding-right: 12px;
    padding-left: 32px;
}

.attachment-list li::before {
    content: "✓";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-weight: bold;
    font-size: 16px;
}

body[dir="ltr"] .attachment-list li::before {
    right: auto;
    left: 12px;
}

.attachment-list li:hover {
    background: var(--bg-section);
}

.optional-list li {
    opacity: 0.85;
}

.optional-list li::before {
    content: "○";
    color: var(--text-secondary);
}

.optional-list li:hover {
    opacity: 1;
}

/* Section Title Variants */
.section-title.mandatory-section {
    color: var(--error);
    border-bottom-color: var(--error);
}

.section-title.optional-section {
    color: var(--text-secondary);
    border-bottom-color: var(--text-secondary);
}

/* --- File Upload --- */

.upload-section {
    margin-bottom: 32px;
}

.upload-item {
    margin-bottom: 20px;
}

.upload-item > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-hint-inline {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.supporting-docs-examples {
    font-size: 0.83rem;
    color: var(--text-secondary);
    margin: -2px 0 10px;
    line-height: 1.5;
}

.upload-dropzone {
    border: 2px dashed var(--border-default);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(0, 107, 60, 0.02);
}

.upload-dropzone .file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-preview {
    margin-top: 8px;
}

.upload-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-section);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.upload-preview-item .file-name {
    color: var(--text-primary);
}

.upload-preview-item .file-size {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upload-preview-item.uploading {
    background: #f0f4ff;
    border-color: #a0b4e0;
    color: var(--text-secondary);
}

.upload-preview-item.upload-success {
    background: #f0faf4;
    border-color: var(--primary);
}

.upload-preview-item.upload-success .upload-status-icon {
    color: var(--primary);
    font-weight: 700;
}

.upload-preview-item.upload-error {
    background: #fff5f5;
    border-color: var(--error);
}

.upload-preview-item.upload-error .upload-status-icon,
.upload-preview-item.upload-error .upload-status {
    color: var(--error);
}

.upload-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    margin-right: auto;
    margin-inline-start: 8px;
    transition: color 0.15s, background 0.15s;
}

.upload-delete-btn:hover {
    color: var(--error);
    background: #fff0f0;
}

.upload-preview-item .upload-status-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.upload-preview-item .upload-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: auto;
}

.upload-preview-item .remove-file {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 0.85rem;
}

/* --- Uploaded Files List --- */

.uploaded-files {
    margin-top: 24px;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-section);
    border-radius: 6px;
    margin-bottom: 8px;
}

.uploaded-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.uploaded-file-info .file-icon {
    font-size: 1.2rem;
}

.uploaded-file-actions {
    display: flex;
    gap: 8px;
}

.uploaded-file-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    flex: 1;
}

.uploaded-file-link:hover {
    text-decoration: underline;
}

.uploaded-file-size {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 12px;
}

.uploaded-file-delete {
    background: none;
    border: 1px solid var(--error);
    color: var(--error);
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}

.uploaded-file-delete:hover {
    background: var(--error);
    color: var(--white);
}

/* --- Navigation --- */

.wizard-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.nav-spacer {
    flex: 1;
}

/* --- Guest Notice Banner --- */

.guest-notice {
    background: rgba(184, 132, 43, 0.1);
    border-bottom: 1px solid rgba(184, 132, 43, 0.4);
    padding: 0.65rem 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--status-pending);
}

.guest-notice a {
    color: var(--adl-green);
    font-weight: 600;
    text-decoration: underline;
}

/* --- Success Panel --- */

.success-panel {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 48px 32px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    animation: fadeInUp 0.5s ease-out;
}

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

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 16px;
}

.success-panel h2 {
    color: var(--success);
    margin-bottom: 12px;
    font-size: 24px;
}

.success-panel p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.success-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* --- Case List Page --- */

.list-container,
.view-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--white);
    transition: all 0.2s;
    flex-shrink: 0;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 12px;
}

.back-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.filter-bar {
    margin-bottom: 20px;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-card);
    min-width: 200px;
}

.cases-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-card-wrapper {
    display: flex;
    align-items: stretch;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.case-card-wrapper:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border-color: #c8d8cc;
}

/* Action buttons on case list cards (استكمال / تعديل) */
.case-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border: none;
    border-right: 1px solid var(--border-light);
    flex-shrink: 0;
    min-width: 62px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.case-action-continue {
    background: #f0faf5;
    color: var(--primary);
    border-right-color: #c6e8d8;
}

.case-action-continue:hover {
    background: #d6f0e3;
    color: #004f2b;
}

.case-action-edit {
    background: #f5f8ff;
    color: #2b6cb0;
    border-right-color: #bee3f8;
}

.case-action-edit:hover {
    background: #dbeafe;
    color: #1a4a8a;
}

.case-card {
    flex: 1;
    background: var(--bg-card);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: background 0.15s;
}

.case-card:hover {
    background: #f7fbf8;
}

.case-card-date {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.case-delete-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 20px;
    background: #fff8f8;
    border: none;
    border-right: 1px solid #fecaca;
    color: #e53e3e;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    min-width: 68px;
    flex-shrink: 0;
}

.case-delete-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.case-delete-btn svg {
    flex-shrink: 0;
}

.case-card-info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.case-card-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.case-card-meta {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* Danger button variants */
.btn-danger {
    background: #e53e3e;
    color: #fff;
    border: 2px solid #e53e3e;
}
.btn-danger:hover { background: #c53030; border-color: #c53030; }
.btn-danger:disabled { background: #fc8181; border-color: #fc8181; cursor: not-allowed; }

.btn-danger-outline {
    background: transparent;
    color: #e53e3e;
    border: 2px solid #e53e3e;
}
.btn-danger-outline:hover { background: #e53e3e; color: #fff; }

/* --- Delete Confirmation Modal --- */
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
    animation: dmFadeIn 0.15s ease;
}

.delete-modal-card {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    animation: dmSlideUp 0.2s ease;
}

.delete-modal-icon {
    width: 68px;
    height: 68px;
    background: #fff5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 2px solid #fecaca;
}

.delete-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.delete-modal-ref {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-section, #f5f7f6);
    border-radius: 6px;
    padding: 6px 16px;
    margin-bottom: 16px;
}

.delete-modal-warning {
    font-size: 0.88rem;
    color: #c53030;
    line-height: 1.65;
    margin-bottom: 28px;
}

.delete-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

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

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

/* Status badges (brand-aligned; visual rule lives in base.css .status-badge) */
/* These per-status colors override only inside cases.css surfaces. */
.status-draft         { background: rgba(184, 132, 43, 0.16); color: var(--status-pending); }
.status-submitted     { background: rgba(31, 90, 69, 0.14);   color: var(--forest-600); }
.status-pending_review{ background: rgba(184, 132, 43, 0.16); color: var(--status-pending); }
.status-approved      { background: rgba(47, 126, 91, 0.16);  color: var(--status-success); }
.status-rejected      { background: rgba(155, 58, 42, 0.14);  color: var(--status-action); }
.status-needs_info    { background: rgba(184, 132, 43, 0.16); color: var(--status-pending); }
.status-closed        { background: var(--neutral-100);       color: var(--neutral-600); }

.loading-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 16px;
}

/* --- Case Detail Page --- */

.case-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.case-detail-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.detail-section {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border-light);
}

.detail-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-item {
    padding: 8px 0;
}

.detail-item .detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.detail-item .detail-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Claims in detail view */
.claim-detail-card {
    background: var(--bg-section);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.claim-detail-card .claim-type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--primary);
    color: var(--white);
    margin-bottom: 8px;
}

/* Files in detail view */
.file-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-section);
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-detail-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.file-detail-item a:hover {
    text-decoration: underline;
}

.file-detail-size {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* --- Contract Pre-fill --- */

.prefill-section {
    margin-bottom: 24px;
}

.prefill-box {
    background: #F0FFF4;
    border: 1px dashed var(--success);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.prefill-text {
    color: var(--success);
    font-size: 0.9rem;
    margin: 0;
}

.prefill-btn {
    white-space: nowrap;
    cursor: pointer;
}

/* Pre-filled field indicator */
.prefilled {
    border-color: var(--success) !important;
    background: #F0FFF4 !important;
}

.autofilled-indicator {
    color: #3b82f6;
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
}

/* Mismatch highlight on field */
.field-mismatch {
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.25) !important;
    animation: mismatchPulse 0.5s ease-in-out 3;
}

@keyframes mismatchPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(214, 158, 46, 0.15); }
}

/* --- Validation Errors --- */

.form-group input.error,
.form-group select.error,
.form-group textarea.error,
input.field-error,
select.field-error,
textarea.field-error {
    border-color: var(--error) !important;
    background-color: #FFF5F5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.upload-dropzone.field-error {
    border-color: var(--error) !important;
    background-color: #FFF5F5;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* === Upload Progress Overlay === */

.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.upload-widget {
    background: #fff;
    border-radius: 24px;
    padding: 44px 52px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
    min-width: 280px;
    animation: widget-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes widget-pop {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.upload-circle-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
}

/* CSS border-based spinner */
.upload-spinner-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 7px solid #e5e7eb;
    border-top-color: var(--primary);
    animation: upload-spin 0.9s linear infinite;
    box-sizing: border-box;
    position: absolute;
    top: 0; left: 0;
    transition: opacity 0.3s ease;
}

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

/* SVG success state */
.upload-success-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100px;
    height: 100px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.upload-success-circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 264;
    transform: rotate(-90deg);
    transform-origin: 50px 50px;
    transition: stroke-dashoffset 0.5s ease;
}

.upload-check {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 70;
    stroke-dashoffset: 70;
    transition: stroke-dashoffset 0.4s ease 0.45s;
}

/* Success state transitions */
.upload-overlay.state-success .upload-spinner-ring {
    opacity: 0;
    animation: none;
}

.upload-overlay.state-success .upload-success-svg {
    opacity: 1;
}

.upload-overlay.state-success .upload-success-circle {
    stroke-dashoffset: 0;
}

.upload-overlay.state-success .upload-check {
    stroke-dashoffset: 0;
}

.upload-widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.upload-widget-sub {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-nav {
        flex-wrap: wrap;
        width: 100%;
    }

    .wizard-progress {
        padding: 24px;
    }

    .form-section {
        padding: 20px;
    }

    .wizard-step {
        padding: 24px;
    }

    .form-container,
    .list-container,
    .view-container {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .wizard-step {
        padding: 20px 16px;
    }

    .form-container,
    .list-container,
    .view-container {
        padding: 16px;
    }

    .step-label {
        font-size: 11px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .claim-type-selector {
        flex-direction: column;
    }

    .case-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .case-card-meta {
        align-items: flex-start;
    }

    .case-delete-btn {
        padding: 0 14px;
        min-width: 56px;
    }

    .wizard-nav {
        flex-direction: column-reverse;
    }

    .wizard-nav .btn {
        width: 100%;
    }

    .upload-buttons {
        flex-direction: column;
    }

    .method-selection {
        grid-template-columns: 1fr;
    }

    .new-case-intro {
        margin: 28px auto;
    }

    .new-case-title {
        font-size: 1.4rem;
    }

    .contract-upload-section {
        padding: 0 16px;
    }

    .upload-card {
        padding: 24px 16px;
    }

    .step-header h2 {
        font-size: 18px;
    }

    .form-section {
        padding: 16px;
    }
}

/* --- Auto-Save Status Indicator --- */

.auto-save-status {
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.3s;
    user-select: none;
    white-space: nowrap;
}

.auto-save-status.saving {
    color: var(--text-secondary);
}

.auto-save-status.saved {
    color: var(--success, #38a169);
}

.auto-save-status.error {
    color: var(--error, #e53e3e);
}

/* --- Checkbox Groups (Step 3 conditional UX) --- */

.checkbox-group {
    margin: 8px 0 12px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    padding: 10px 14px;
    background: var(--bg-section);
    border: 1.5px solid var(--border-light);
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}

.checkbox-label:hover {
    border-color: var(--primary);
    background: rgba(0, 107, 60, 0.03);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ── Guest case number banner ── */
.guest-case-banner {
    max-width: 760px;
    margin: 0 auto 1rem;
    padding: 0 1rem;
}

.guest-case-banner-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f0f7f4;
    border: 1.5px solid #b2d8c8;
    border-radius: 10px;
    padding: 0.65rem 1.1rem;
    flex-wrap: wrap;
}

.guest-case-banner-label {
    font-size: 0.8rem;
    color: #555;
    white-space: nowrap;
}

.guest-case-banner-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--adl-green);
    letter-spacing: 0.03em;
    direction: ltr;
    font-family: var(--font-mono);
}

.guest-case-banner-hint {
    font-size: 0.78rem;
    color: #777;
    margin-right: auto;
}

.guest-case-banner-hint a {
    color: var(--adl-green);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .guest-case-banner-inner { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
    .guest-case-banner-hint { margin-right: 0; }
}
