/* ============================================================
   Comfortside Survey Plugin — Frontend Styles
   Colors: #2BC3D0 (primary), #3A4A5C (dark)
   Fonts: Oswald, Raleway (from theme)
   ============================================================ */

:root {
    --cs-primary:   #2BC3D0;
    --cs-dark:      #3A4A5C;
    --cs-primary-h: #1fa8b4;
    --cs-success:   #27ae60;
    --cs-error:     #e74c3c;
    --cs-border:    #e2e8f0;
    --cs-bg:        #f7fafc;
    --cs-text:      #2d3748;
    --cs-muted:     #718096;
    --cs-white:     #ffffff;
    --cs-shadow:    0 4px 24px rgba(0,0,0,0.08);
    --cs-radius:    12px;
    --cs-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Wrap ────────────────────────────────────────────────── */
.cs-survey-wrap {
    max-width: 760px;
    margin: 48px auto;
    padding: 0 20px 60px;
    font-family: 'Raleway', sans-serif;
    color: var(--cs-text);
}

/* ── Page Header ─────────────────────────────────────────── */
.cs-survey-header {
    text-align: center;
    margin-bottom: 40px;
}

.cs-survey-page-title {
    font-family: 'Oswald', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--cs-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.cs-survey-page-sub {
    color: var(--cs-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* ── Section ─────────────────────────────────────────────── */
.cs-section {
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow);
    padding: 32px 36px;
    margin-bottom: 24px;
    border-top: 4px solid var(--cs-primary);
}

.cs-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cs-border);
}

.cs-section-num {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--cs-primary);
    line-height: 1;
    opacity: 0.7;
}

.cs-section-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--cs-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* ── Field ───────────────────────────────────────────────── */
.cs-field {
    margin-bottom: 28px;
}

.cs-field:last-child {
    margin-bottom: 0;
}

.cs-label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--cs-dark);
    margin-bottom: 12px;
}

.cs-req    { color: var(--cs-primary); }
.cs-optional { color: var(--cs-muted); font-weight: 400; font-size: 0.85em; }

/* ── Stars ───────────────────────────────────────────────── */
.cs-stars {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cs-star {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #cbd5e0;
    transition: color var(--cs-transition), transform var(--cs-transition);
    line-height: 0;
}

.cs-star svg {
    width: 38px;
    height: 38px;
    fill: currentColor;
    display: block;
}

.cs-star:hover,
.cs-star.cs-star--hover,
.cs-star.cs-star--active {
    color: #f6c90e;
    transform: scale(1.15);
}

.cs-star-label {
    font-size: 0.88rem;
    color: var(--cs-muted);
    margin-left: 8px;
    font-weight: 600;
    min-width: 80px;
}

/* ── Radio Cards ─────────────────────────────────────────── */
.cs-radio-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
}

.cs-radio-group--wrap {
    flex-wrap: wrap;
}

.cs-radio-card {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    flex: 1;
    min-width: fit-content;
}

.cs-radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.cs-radio-label {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 16px;
    border: 2px solid var(--cs-border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--cs-muted);
    background: var(--cs-white);
    transition: all var(--cs-transition);
    cursor: pointer;
    white-space: nowrap;
}

.cs-radio-card:hover .cs-radio-label {
    border-color: var(--cs-primary);
    color: var(--cs-primary);
    background: rgba(43, 195, 208, 0.05);
}

.cs-radio-card input[type="radio"]:checked + .cs-radio-label {
    border-color: var(--cs-primary);
    background: var(--cs-primary);
    color: var(--cs-white);
    box-shadow: 0 2px 8px rgba(43, 195, 208, 0.35);
}

/* ── Rating Grid ─────────────────────────────────────────── */
.cs-grid-wrap {
    overflow-x: auto;
}

.cs-rating-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cs-rating-grid th {
    padding: 10px 14px;
    text-align: center;
    color: var(--cs-muted);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--cs-border);
}

.cs-rating-grid th:first-child { text-align: left; }

.cs-rating-grid td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--cs-border);
}

.cs-rating-grid tr:last-child td { border-bottom: none; }

.cs-grid-row-label {
    text-align: left !important;
    font-weight: 600;
    color: var(--cs-dark);
}

.cs-grid-cell {
    display: flex;
    justify-content: center;
    cursor: pointer;
}

.cs-grid-cell input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cs-grid-dot {
    width: 22px;
    height: 22px;
    border: 2px solid var(--cs-border);
    border-radius: 50%;
    background: var(--cs-white);
    transition: all var(--cs-transition);
    position: relative;
}

.cs-grid-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cs-primary);
    transition: transform var(--cs-transition);
}

.cs-grid-cell:hover .cs-grid-dot {
    border-color: var(--cs-primary);
}

.cs-grid-cell input[type="radio"]:checked + .cs-grid-dot {
    border-color: var(--cs-primary);
}

.cs-grid-cell input[type="radio"]:checked + .cs-grid-dot::after {
    transform: translate(-50%, -50%) scale(1);
}

.cs-rating-grid tr:hover td {
    background: rgba(43, 195, 208, 0.03);
}

/* ── Other Field ─────────────────────────────────────────── */
.cs-other-field {
    margin-top: 12px;
    overflow: hidden;
    animation: cs-slide-down 0.25s ease forwards;
}

@keyframes cs-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Inputs ──────────────────────────────────────────────── */
.cs-input,
.cs-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--cs-border);
    border-radius: 8px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.95rem;
    color: var(--cs-text);
    background: var(--cs-white);
    transition: border-color var(--cs-transition), box-shadow var(--cs-transition);
    outline: none;
}

.cs-input:focus,
.cs-textarea:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(43, 195, 208, 0.15);
}

.cs-textarea { resize: vertical; }

/* ── Errors ──────────────────────────────────────────────── */
.cs-error {
    font-size: 0.82rem;
    color: var(--cs-error);
    font-weight: 600;
    margin-top: 6px;
    min-height: 1em;
}

.cs-error--global {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.cs-field--error .cs-radio-label { border-color: rgba(231, 76, 60, 0.4); }
.cs-field--error .cs-input,
.cs-field--error .cs-textarea   { border-color: var(--cs-error); }
.cs-field--error .cs-stars      { filter: drop-shadow(0 0 4px rgba(231,76,60,0.3)); }

/* ── Submit ──────────────────────────────────────────────── */
.cs-submit-wrap {
    text-align: center;
    margin-top: 32px;
}

.cs-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--cs-dark);
    color: var(--cs-white);
    border: none;
    border-radius: 8px;
    padding: 16px 56px;
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all var(--cs-transition);
    min-width: 220px;
}

.cs-submit-btn:hover:not(:disabled) {
    background: var(--cs-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(43, 195, 208, 0.4);
}

.cs-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.cs-submit-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cs-spin 0.7s linear infinite;
}

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

/* ── State Cards (invalid, completed, success) ───────────── */
.cs-survey-card {
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow);
    padding: 60px 40px;
    text-align: center;
    max-width: 520px;
    margin: 80px auto;
}

.cs-survey-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
}

.cs-survey-icon svg {
    width: 40px;
    height: 40px;
}

.cs-survey-icon--invalid  { background: rgba(231, 76, 60, 0.1); color: var(--cs-error); }
.cs-survey-icon--completed { background: rgba(43, 195, 208, 0.1); color: var(--cs-primary); }
.cs-survey-icon--success   { background: rgba(39, 174, 96, 0.1);  color: var(--cs-success); animation: cs-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

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

.cs-survey-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cs-dark);
    margin-bottom: 12px;
}

.cs-survey-subtitle {
    color: var(--cs-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 28px;
}

.cs-survey-btn {
    display: inline-block;
    background: var(--cs-primary);
    color: var(--cs-white);
    padding: 12px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background var(--cs-transition);
}

.cs-survey-btn:hover {
    background: var(--cs-primary-h);
    color: var(--cs-white);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .cs-section {
        padding: 24px 20px;
    }

    .cs-radio-group {
        flex-wrap: wrap;
    }

    .cs-radio-card {
        flex: 0 0 calc(50% - 5px);
    }

    .cs-survey-page-title {
        font-size: 1.6rem;
    }

    .cs-submit-btn {
        width: 100%;
        padding: 16px;
    }
}
