/*
  =================================================================
  فایل استایل اختصاصی محاسبه‌گر چرخه خواب
  نسخه: 2.0 - بهینه‌سازی شده با A11y (Contrast) و E-E-A-T
  =================================================================
*/

/* --- Segmented Control --- */
.segmented-control {
    display: flex;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    overflow: hidden;
}
.segmented-control.small-text label { font-size: 0.9rem; padding: 10px 5px; }
.segmented-control input[type="radio"] { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none; }
.segmented-control label {
    flex: 1; text-align: center; padding: 12px 10px; font-size: 1rem;
    font-weight: bold; cursor: pointer; transition: var(--transition-fast);
    color: var(--light-text-color); background-color: var(--bg-color);
}
.segmented-control label:not(:last-child) { border-left: 1px solid var(--border-color); /* RTL */ }
.segmented-control input[type="radio"]:checked + label { background-color: var(--primary-color); color: white; }

/* --- Time Input --- */
.time-input {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 1.3rem; /* Larger font for time */
    font-family: var(--font-family-base);
    background-color: white;
    text-align: center;
}
.time-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.1);
    outline: none;
}
input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

/* --- Button Group --- */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 25px;
}
.button-group .primary-cta {
    background-color: var(--cat-سلامت-روان, #007bff);
}
.button-group .primary-cta:hover {
    background-color: #0056b3;
}
.button-group .secondary-cta {
    background-color: var(--bg-color);
    color: var(--cat-سلامت-روان, #007bff);
    border: 2px solid var(--cat-سلامت-روان, #007bff);
}
.button-group .secondary-cta:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* --- Custom Sleep Result Card --- */
/* A11y Contrast Fix: Darkened gradient for white text (passes WCAG AA) */
.result-card-sleep {
    background: linear-gradient(145deg, #004a99, #0056b3); 
    color: white;
    border-radius: var(--border-radius-base);
    padding: 30px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.result-card-sleep.visible { opacity: 1; transform: translateY(0); }

.result-card-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.result-times {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.time-option {
    background-color: rgba(255, 255, 255, 0.15); /* Slightly more opaque */
    padding: 15px 10px;
    border-radius: var(--border-radius-small);
    text-align: center;
    animation: fade-in 0.5s ease-out backwards;
}
/* Stagger animation */
.time-option:nth-child(1) { animation-delay: 0.1s; }
.time-option:nth-child(2) { animation-delay: 0.2s; }
.time-option:nth-child(3) { animation-delay: 0.3s; }
.time-option:nth-child(4) { animation-delay: 0.4s; }
.time-option:nth-child(5) { animation-delay: 0.5s; }
.time-option:nth-child(6) { animation-delay: 0.6s; }


.time-option .time {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: white;
}
.time-option .cycles {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.result-note {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 10px;
}

/* --- Result Card CTA Button --- */
.result-card-sleep .secondary-cta {
    background-color: white;
    color: #0056b3; /* Match dark blue for good contrast */
    font-weight: bold;
    margin-top: 15px;
}
.result-card-sleep .secondary-cta:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* --- A11y: Reduce Motion --- */
@media (prefers-reduced-motion: reduce) {
  .result-card-sleep,
  .result-card-sleep.visible,
  .time-option,
  .segmented-control label {
    transition: none;
    animation: none;
  }
  
  html {
    scroll-behavior: auto;
  }
}