/**
 * Frontend styles for Cole&Muller Recruitment Plugin
 *
 * @package Cole_Muller_Recruitment
 */

/* =========================================
   FORM CONTAINER
   ========================================= */
.cmr-form-container {
    font-family: 'Onest', sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

.cmr-form-container *,
.cmr-form-container *::before,
.cmr-form-container *::after {
    box-sizing: border-box;
}

/* =========================================
   PROGRESS BAR
   ========================================= */
.cmr-progress-section {
    margin-bottom: 2rem;
}

.cmr-progress-track {
    width: 100%;
    background-color: #e5e7eb;
    border-radius: 9999px;
    height: 0.625rem;
    overflow: hidden;
}

.cmr-progress-bar {
    height: 0.625rem;
    border-radius: 9999px;
    background-color: #0462F9;
    transition: width 0.5s ease-out;
}

.cmr-progress-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #4b5563;
    text-align: center;
}

/* =========================================
   CARDS
   ========================================= */
.cmr-card {
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -4px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

/* =========================================
   STEP HEADINGS
   ========================================= */
.cmr-step-title {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-family: 'Onest', sans-serif;
    margin-top: 0;
}

.cmr-text-center {
    text-align: center;
}

.cmr-step-subtitle {
    color: #4b5563;
    text-align: center;
    margin-bottom: 2rem;
}

/* =========================================
   SELECTION CARDS GRID (Step 0)
   ========================================= */
.cmr-selection-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .cmr-selection-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   SELECTION CARDS
   ========================================= */
.cmr-selection-card {
    padding: 1.5rem;
    border: 2px solid #d1d5db;
    border-radius: 0.75rem;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    text-align: left;
    cursor: pointer;
    background-color: #ffffff;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
}

.cmr-selection-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
                0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.cmr-selection-card:focus {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #3b82f6;
}

.cmr-border-default {
    border-color: #d1d5db;
}

.cmr-border-primary {
    border-color: #0462F9 !important;
}

.cmr-bg-active {
    background-color: #eff6ff !important;
}

.cmr-card-title {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 0;
    font-family: 'Onest', sans-serif;
}

.cmr-card-desc {
    color: #4b5563;
    margin: 0;
}

/* =========================================
   BUTTONS
   ========================================= */
.cmr-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    color: #ffffff;
    font-weight: 500;
    background-color: #0462F9;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
    font-size: 1rem;
    line-height: 1.5rem;
    font-family: inherit;
}

.cmr-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.cmr-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.cmr-btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #3b82f6;
}

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

.cmr-btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    color: #374151;
    background-color: #ffffff;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    font-size: 1rem;
    line-height: 1.5rem;
    font-family: inherit;
}

.cmr-btn-back:hover {
    background-color: #f9fafb;
    transform: translateY(-1px);
}

.cmr-btn-back:active {
    transform: translateY(0);
}

.cmr-btn-back:focus {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #6b7280;
}

/* =========================================
   BUTTON ROW
   ========================================= */
.cmr-button-row {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cmr-button-row.cmr-justify-end {
    justify-content: flex-end;
}

/* =========================================
   FORM FIELDS
   ========================================= */
.cmr-form-fields > * + * {
    margin-top: 1.5rem;
}

.cmr-label {
    display: block;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.cmr-required {
    color: #ef4444;
}

.cmr-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    line-height: 1.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-color: #ffffff;
    color: #111827;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

select.cmr-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.cmr-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(4, 98, 249, 0.1);
}

.cmr-input-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.cmr-field-error {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #ef4444;
}

.cmr-char-count {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: #6b7280;
    text-align: right;
}

/* =========================================
   REVIEW SECTION (Step 4)
   ========================================= */
.cmr-review-section {
    margin-bottom: 2rem;
}

.cmr-review-section > * + * {
    margin-top: 1rem;
}

.cmr-review-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
}

@media (min-width: 768px) {
    .cmr-review-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cmr-review-label {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: #374151;
    display: block;
}

.cmr-review-value {
    color: #111827;
    margin: 0.125rem 0 0 0;
}

/* =========================================
   SUCCESS MESSAGE
   ========================================= */
.cmr-success-icon {
    margin-bottom: 1rem;
    text-align: center;
}

.cmr-success-svg {
    display: block;
    margin: 0 auto;
    height: 4rem;
    width: 4rem;
    color: #22c55e;
    animation: cmr-checkmark 0.5s ease-out;
}

.cmr-success-title {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 0;
    font-family: 'Onest', sans-serif;
    color: #0462F9;
}

.cmr-success-text {
    color: #4b5563;
    margin-bottom: 1.5rem;
}

@keyframes cmr-checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* =========================================
   SPINNER
   ========================================= */
@keyframes cmr-spin {
    to { transform: rotate(360deg); }
}

.cmr-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-bottom-color: #ffffff;
    border-radius: 9999px;
    margin-right: 0.5rem;
    animation: cmr-spin 1s linear infinite;
    vertical-align: middle;
}

/* =========================================
   SCREEN READER ONLY
   ========================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =========================================
   ALPINE.JS TRANSITION UTILITIES
   ========================================= */
.cmr-transition-slide {
    transition-property: opacity, transform;
    transition-timing-function: ease-out;
    transition-duration: 300ms;
}

.cmr-transition-slide-start {
    opacity: 0;
    transform: translateX(1rem);
}

.cmr-transition-slide-end {
    opacity: 1;
    transform: translateX(0);
}

.cmr-transition-scale {
    transition-property: opacity, transform;
    transition-timing-function: ease-out;
    transition-duration: 300ms;
}

.cmr-transition-scale-start {
    opacity: 0;
    transform: scale(0.95);
}

.cmr-transition-scale-end {
    opacity: 1;
    transform: scale(1);
}

/* =========================================
   ENHANCED STATES
   ========================================= */
.cmr-form-container input:invalid:not(:focus):not(:placeholder-shown),
.cmr-form-container textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.cmr-form-container *:focus-visible {
    outline: 2px solid #0462F9;
    outline-offset: 2px;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 767px) {
    .cmr-form-container {
        padding: 1rem;
    }

    .cmr-card {
        padding: 1.5rem;
    }

    .cmr-button-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cmr-button-row button {
        width: 100%;
    }

    .cmr-button-row.cmr-justify-end {
        align-items: stretch;
    }

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

    .cmr-review-grid {
        grid-template-columns: 1fr;
    }
}
