/*
 * Hebrew Handwriting Collection - Styles
 * Mobile-first, RTL-supporting CSS
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

/* Visually hidden but accessible */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    max-width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

.main-content {
    flex: 1;
}

/* ============================================
   HEADER
   ============================================ */

.site-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 1.5rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    text-align: center;
    flex: 1;
}

.site-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.site-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.user-email {
    opacity: 0.9;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background-color: #1e293b;
    color: #cbd5e1;
    padding: 1.5rem 1rem;
    text-align: center;
    margin-top: 2rem;
}

.site-footer a {
    color: #60a5fa;
}

.footer-note {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* ============================================
   INFO SECTION
   ============================================ */

.info-compact {
    font-size: 0.875rem;
    color: #64748b;
    text-align: center;
    margin: 0;
}

.info-compact a {
    color: #2563eb;
    font-weight: 500;
}

/* ============================================
   SECTIONS
   ============================================ */

section {
    background: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Compact variant */
section.compact {
    padding: 1rem;
    margin-bottom: 1rem;
}

.intro-section {
    text-align: center;
}

.intro-text {
    font-size: 1rem;
    color: #475569;
    max-width: 600px;
    margin: 0 auto;
}

.intro-section.compact {
    padding: 0.75rem 1rem;
}

/* ============================================
   STATISTICS BOX
   ============================================ */

.stats-section {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
    box-shadow: none;
}

/* ============================================
   GUIDELINES
   ============================================ */

.guidelines-toggle {
    cursor: pointer;
}

.guidelines-toggle summary {
    font-weight: 500;
    color: #1e293b;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
    list-style: none;
    user-select: none;
}

.guidelines-toggle summary::-webkit-details-marker {
    display: none;
}

.guidelines-toggle summary::before {
    content: "◀ ";
    display: inline-block;
    transition: transform 0.2s;
}

.guidelines-toggle[open] summary::before {
    transform: rotate(-90deg);
}

.guidelines-toggle summary:hover {
    background-color: #f1f5f9;
}

.guidelines-content {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: #f8fafc;
    border-radius: 6px;
    font-size: 0.9rem;
}

.guidelines-content p {
    margin-bottom: 0.5rem;
}

.guidelines-content p:last-child {
    margin-bottom: 0;
}

.warning-text {
    color: #92400e;
    background-color: #fef3c7;
    padding: 0.5rem;
    border-radius: 4px;
    border-right: 3px solid #f59e0b;
}

.guideline-item {
    background-color: #f8fafc;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    border-right: 4px solid #2563eb;
}

.guideline-item strong {
    display: block;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.guideline-item ul {
    margin-right: 1.5rem;
    margin-top: 0.5rem;
}

.guideline-item.warning {
    background-color: #fef3c7;
    border-right-color: #f59e0b;
}

.guideline-item.warning strong {
    color: #92400e;
}

/* ============================================
   UPLOAD AREA
   ============================================ */

.upload-area {
    display: block;
    border: 3px dashed #cbd5e1;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8fafc;
    margin: 1.5rem 0;
}

.upload-area.compact {
    padding: 2rem 1.5rem;
    margin: 1rem 0;
}

.upload-area:hover {
    border-color: #2563eb;
    background-color: #eff6ff;
}

.upload-area.dragover {
    border-color: #2563eb;
    background-color: #dbeafe;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-area.compact .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.upload-area.compact .upload-text {
    font-size: 1rem;
}

.upload-formats {
    font-size: 0.875rem;
    color: #64748b;
}

.upload-area.compact .upload-formats {
    font-size: 0.8rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-height: 44px;
    line-height: 1.5;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
    text-decoration: none;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #cbd5e1;
    text-decoration: none;
}

.upload-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.mobile-only {
    display: none;
}

/* ============================================
   FILE PREVIEW
   ============================================ */

.file-preview {
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.file-summary {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

#fileList {
    list-style: none;
    margin-top: 1rem;
}

#fileList li {
    background-color: white;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-right: 3px solid #10b981;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: 500;
    color: #1e293b;
}

.file-size {
    font-size: 0.875rem;
    color: #64748b;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-section {
    margin: 2rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

label.required::after {
    content: " *";
    color: #ef4444;
}

input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   SLIDER (Legibility Score)
   ============================================ */

.slider-container {
    margin: 1rem 0;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #2563eb;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #2563eb;
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-value {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2563eb;
    margin-top: 0.5rem;
}

.slider-value .value-unselected {
    color: #94a3b8;
    font-style: italic;
}

input[type="range"].slider-unselected {
    opacity: 0.5;
}

input[type="range"].slider-unselected::-webkit-slider-thumb {
    background: #94a3b8;
}

input[type="range"].slider-unselected::-moz-range-thumb {
    background: #94a3b8;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    padding: 0 2px;
}

.slider-ticks span {
    text-align: center;
    min-width: 0;
    flex: 1;
}

.slider-ticks span:first-child {
    text-align: right;
}

.slider-ticks span:last-child {
    text-align: left;
}

/* ============================================
   CHOICE BUTTONS (Radio as buttons)
   ============================================ */

.choice-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.choice-btn {
    flex: 1;
    min-width: 80px;
}

.choice-btn input[type="radio"] {
    display: none;
}

.choice-btn span {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    font-weight: 500;
}

.choice-btn span:hover {
    border-color: #2563eb;
    background: #f0f7ff;
}

.choice-btn input[type="radio"]:checked + span {
    border-color: #2563eb;
    background: #2563eb;
    color: white;
}

.other-input-container {
    margin-top: 0.75rem;
}

.other-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.other-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* ============================================
   CHECKBOX
   ============================================ */

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-left: 0.75rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
    cursor: pointer;
    transform: scale(1.2);
}

.checkbox-text {
    font-weight: normal;
}

.consent-group {
    background-color: #fef3c7;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #fbbf24;
}

/* ============================================
   FORM ACTIONS
   ============================================ */

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* ============================================
   PROGRESS INDICATOR
   ============================================ */

.progress-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.step {
    flex: 1;
    text-align: center;
    font-size: 0.875rem;
    color: #94a3b8;
    padding: 0.5rem;
    position: relative;
}

.step.completed {
    color: #10b981;
    font-weight: 500;
}

.step.completed::before {
    content: "✓ ";
}

.step.active {
    color: #2563eb;
    font-weight: 600;
}

/* ============================================
   FILES SUMMARY
   ============================================ */

.files-summary {
    text-align: center;
    padding: 2rem 1rem;
}

.summary-text {
    color: #475569;
    max-width: 500px;
    margin: 1rem auto;
}

/* ============================================
   CONFIRMATION PAGE
   ============================================ */

.confirmation-page,
.error-page {
    text-align: center;
    padding: 2rem 0;
}

.success-icon,
.error-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.thank-you-section,
.error-section {
    margin-bottom: 2rem;
}

.confirmation-text,
.error-text {
    font-size: 1.125rem;
    color: #475569;
    max-width: 500px;
    margin: 1rem auto;
}

.submission-details {
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.detail-box {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem auto;
    max-width: 400px;
}

.submission-id {
    font-family: monospace;
    font-size: 0.875rem;
    color: #64748b;
    word-break: break-all;
}

.next-steps,
.help-section {
    text-align: right;
    background-color: #eff6ff;
    padding: 1.5rem;
    border-radius: 8px;
    border-right: 4px solid #2563eb;
    margin: 2rem 0;
}

.next-steps-content p,
.help-list li {
    margin-bottom: 1rem;
}

.help-list {
    list-style: none;
    margin-right: 0;
}

.help-list li::before {
    content: "→ ";
    color: #2563eb;
    font-weight: bold;
}

.confirmation-actions,
.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.info-box {
    background-color: #f0fdf4;
    padding: 1.5rem;
    border-radius: 8px;
    border-right: 4px solid #10b981;
    margin-top: 2rem;
}

.info-text {
    margin: 0;
    color: #166534;
}

/* ============================================
   ERROR PAGE
   ============================================ */

.error-list {
    background-color: #fee2e2;
    padding: 1.5rem;
    border-radius: 8px;
    border-right: 4px solid #ef4444;
    margin: 1rem auto;
    max-width: 500px;
    text-align: right;
}

.error-list ul {
    list-style: none;
    margin-top: 1rem;
    margin-right: 0;
}

.error-list li {
    padding: 0.5rem 0;
    color: #991b1b;
}

.error-list li::before {
    content: "⚠ ";
    margin-left: 0.5rem;
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding: 2rem;
    }

    .site-title {
        font-size: 2.5rem;
    }

    .upload-area {
        padding: 4rem 3rem;
    }

    section {
        padding: 2rem;
    }
}

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */

@media (min-width: 1024px) {
    .container {
        max-width: 900px;
    }

    .form-actions {
        justify-content: flex-end;
    }
}

/* ============================================
   MOBILE DEVICE DETECTION
   ============================================ */

@media (max-width: 767px) {
    .mobile-only {
        display: inline-block;
    }
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    max-width: 500px;
    margin: 0 auto;
}

.login-section {
    text-align: center;
    padding: 2rem;
}

.login-text {
    font-size: 1rem;
    color: #475569;
    margin: 1rem 0 2rem;
}

.login-actions {
    margin: 2rem 0;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background-color: white;
    color: #1e293b;
    border: 2px solid #e2e8f0;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-google:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-decoration: none;
}

.btn-google svg {
    flex-shrink: 0;
}

.login-info {
    text-align: right;
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
    font-size: 0.9rem;
}

.login-info strong {
    display: block;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.login-info ul {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
}

.login-info li {
    padding: 0.5rem 0;
    color: #475569;
}

.login-info li::before {
    content: "✓ ";
    color: #10b981;
    font-weight: bold;
    margin-left: 0.5rem;
}

.privacy-note {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .site-header,
    .site-footer,
    .btn {
        display: none;
    }
}
