/**
 * Date Picker Styles
 *
 * @package MallorcaRenting
 * @since 1.0.0
 */

/* ===============================================
   BASE DATE PICKER STYLES
   =============================================== */

.mallorca-date-picker-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.date-picker-form {
    position: relative;
}

/* ===============================================
   HORIZONTAL LAYOUT (DEFAULT)
   =============================================== */

.mallorca-date-picker-container[data-style="horizontal"] .date-picker-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.mallorca-date-picker-container[data-style="horizontal"] .date-picker-field {
    flex: 1;
    min-width: 140px;
}

.mallorca-date-picker-container[data-style="horizontal"] .actions-field {
    flex: 0 0 auto;
}

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

.mallorca-date-picker-container[data-style="vertical"] .date-picker-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 300px;
}

.mallorca-date-picker-container[data-style="vertical"] .date-picker-field {
    width: 100%;
}

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

.mallorca-date-picker-container[data-style="compact"] {
    padding: 15px;
    border-radius: 8px;
}

.date-picker-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.compact-dates {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compact-input {
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    min-width: 120px;
}

.date-separator {
    color: #666;
    font-weight: 500;
}

.compact-guests {
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    min-width: 100px;
}

.btn-compact {
    padding: 8px 16px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
}

/* ===============================================
   FORM FIELDS
   =============================================== */

.date-picker-field {
    position: relative;
    display: flex;
    flex-direction: column;
}

.date-picker-field label {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;
}

.date-input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
}

.date-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.date-input:invalid {
    border-color: #dc3545;
}

.date-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #333;
    font-size: 16px;
    background: transparent;
}

/* ===============================================
   GUESTS SELECTOR
   =============================================== */

.guests-selector {
    position: relative;
}

.guests-trigger {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.guests-trigger:hover,
.guests-trigger:focus {
    border-color: #007cba;
    outline: none;
}

.guests-trigger.active {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.guests-text {
    color: #333;
    font-weight: 500;
}

.guests-arrow {
    color: #666;
    transition: transform 0.3s ease;
}

.guests-trigger.active .guests-arrow {
    transform: rotate(180deg);
}

.guests-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #007cba;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.guest-type {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.guest-type:last-of-type {
    margin-bottom: 20px;
}

.guest-type label {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.guest-counter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.guest-minus,
.guest-plus {
    width: 32px;
    height: 32px;
    border: 2px solid #007cba;
    background: #fff;
    color: #007cba;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.guest-minus:hover,
.guest-plus:hover {
    background: #007cba;
    color: #fff;
}

.guest-minus:disabled,
.guest-plus:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.guest-input {
    width: 60px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: #f8f9fa;
}

.guests-done {
    width: 100%;
    padding: 10px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.guests-done:hover {
    background: #005a87;
}

.guests-select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.guests-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

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

.date-picker-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-picker-search {
    padding: 12px 24px;
    background: linear-gradient(135deg, #007cba, #00a0d2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.date-picker-search:hover {
    background: linear-gradient(135deg, #005a87, #007cba);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.date-picker-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.search-icon {
    font-size: 14px;
}

.date-picker-clear {
    padding: 12px 20px;
    background: transparent;
    color: #666;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-picker-clear:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, #007cba, #00a0d2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary {
    padding: 12px 20px;
    background: transparent;
    color: #666;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* ===============================================
   MESSAGES
   =============================================== */

.date-picker-messages {
    margin-top: 15px;
}

.date-picker-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    font-size: 14px;
}

.date-picker-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* ===============================================
   SELECTED DATES SUMMARY
   =============================================== */

.selected-dates-summary {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

.dates-text {
    font-weight: 600;
    color: #333;
}

.nights-count {
    margin-left: 10px;
    color: #007cba;
}

/* ===============================================
   HEADER DATES STYLES
   =============================================== */

.mallorca-header-dates {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Inline Style */
.header-dates-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.header-dates-text {
    font-weight: 600;
    color: #333;
}

.header-guests-text {
    color: #666;
}

.edit-dates-link {
    color: #007cba;
    text-decoration: none;
    font-size: 12px;
}

.edit-dates-link:hover {
    text-decoration: underline;
}

.no-dates-text {
    color: #999;
    font-style: italic;
}

/* Dropdown Style */
.header-dates-dropdown {
    position: relative;
}

.header-dates-trigger {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 200px;
    justify-content: space-between;
}

.header-dates-trigger:hover {
    border-color: #007cba;
}

.header-dates-trigger.active {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.dates-icon {
    font-size: 16px;
}

.dropdown-arrow {
    color: #666;
    transition: transform 0.3s ease;
}

.header-dates-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

.header-dates-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #007cba;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: none;
}

.header-dates-content.active {
    display: block;
}

.current-selection {
    margin-bottom: 15px;
}

.selected-dates strong {
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.date-details {
    font-size: 16px;
    font-weight: 600;
    color: #007cba;
    margin-bottom: 8px;
}

.separator {
    color: #666;
    margin: 0 8px;
}

.nights-info,
.guests-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.header-dates-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.edit-dates-btn,
.clear-dates-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.edit-dates-btn {
    background: #007cba;
    color: #fff;
    border: none;
}

.edit-dates-btn:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.clear-dates-btn {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.clear-dates-btn:hover {
    background: #dc3545;
    color: #fff;
}

/* Badge Style */
.header-dates-badge {
    display: inline-flex;
    align-items: center;
}

.dates-badge {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.badge-icon {
    font-size: 16px;
}

.badge-text {
    font-weight: 600;
    color: #333;
}

.guests-badge {
    background: #e3f2fd;
    border-radius: 12px;
    padding: 4px 8px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.guests-icon {
    font-size: 12px;
}

.guests-text {
    font-size: 12px;
    font-weight: 600;
    color: #1565c0;
}

.edit-dates-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.edit-dates-icon:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ===============================================
   THEME VARIATIONS
   =============================================== */

/* Modern Theme */
.mallorca-date-picker-container[data-theme="modern"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.mallorca-date-picker-container[data-theme="modern"] .date-input,
.mallorca-date-picker-container[data-theme="modern"] .guests-trigger,
.mallorca-date-picker-container[data-theme="modern"] .guests-select {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.mallorca-date-picker-container[data-theme="modern"] label {
    color: #fff;
}

/* Minimal Theme */
.mallorca-date-picker-container[data-theme="minimal"] {
    box-shadow: none;
    border: 1px solid #e0e0e0;
    border-radius: 0;
}

.mallorca-date-picker-container[data-theme="minimal"] .date-input {
    border-radius: 0;
    border-width: 1px;
}

.mallorca-date-picker-container[data-theme="minimal"] .date-picker-search {
    border-radius: 0;
    background: #333;
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

@media (max-width: 768px) {
    .mallorca-date-picker-container[data-style="horizontal"] .date-picker-row {
        flex-direction: column;
        gap: 20px;
    }

    .mallorca-date-picker-container[data-style="horizontal"] .date-picker-field {
        min-width: 100%;
    }

    .date-picker-compact {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .compact-dates {
        flex-direction: column;
        gap: 10px;
    }

    .date-separator {
        display: none;
    }

    .header-dates-trigger {
        min-width: 150px;
    }

    .header-dates-content {
        left: -10px;
        right: -10px;
    }

    .date-picker-actions {
        flex-direction: column;
    }

    .date-picker-search,
    .date-picker-clear {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .mallorca-date-picker-container {
        padding: 15px;
        margin: 10px 0;
    }

    .date-input,
    .guests-trigger,
    .guests-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .guests-dropdown {
        padding: 15px;
    }

    .header-dates-badge .dates-badge {
        padding: 6px 12px;
        font-size: 12px;
    }

    .header-dates-inline {
        flex-wrap: wrap;
    }
}

/* ===============================================
   ACCESSIBILITY
   =============================================== */

.date-input:focus,
.guests-trigger:focus,
.guests-select:focus,
.date-picker-search:focus,
.date-picker-clear:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.guest-minus:focus,
.guest-plus:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* 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: 0;
}

/* ===============================================
   ANIMATIONS
   =============================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.guests-dropdown,
.header-dates-content {
    animation: fadeIn 0.3s ease;
}

/* ===============================================
   LOADING STATES
   =============================================== */

.date-picker-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.date-picker-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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