/**
 * Frontend Styles for Super Restaurant Reservations
 * Version: 2.0.0 - Theme-Independent with CSS Isolation
 * 
 * This CSS is designed to work independently of any WordPress theme
 * by using specific selectors and CSS reset techniques.
 */

/* ========================================
   CSS RESET & ISOLATION
   Ensures plugin styles work regardless of theme
   ======================================== */

.super-restaurant-booking-wrapper,
.super-restaurant-booking-wrapper * {
    /* Reset box-sizing */
    box-sizing: border-box;
    
    /* Reset margins and paddings */
    margin: 0;
    padding: 0;
    
    /* Reset font properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.5;
    
    /* Reset text properties */
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    word-spacing: normal;
    
    /* Reset borders */
    border: none;
    outline: none;
}

/* ========================================
   MAIN WRAPPER
   ======================================== */

.super-restaurant-booking-wrapper {
    /* Layout */
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px;
    padding: 40px;
    
    /* Appearance */
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    
    /* Typography reset */
    font-size: 16px;
    color: #333333;
    line-height: 1.6;
    
    /* Ensure it appears above most theme elements */
    position: relative;
    z-index: 1;
}

/* Container for full-width themes */
.super-restaurant-booking-wrapper.full-width {
    max-width: 100%;
}

/* ========================================
   TITLE
   ======================================== */

.super-restaurant-title {
    /* Reset heading styles */
    margin: 0 0 30px 0 !important;
    padding: 0 !important;
    
    /* Typography */
    font-size: 32px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: #1a1a1a !important;
    text-align: center !important;
    
    /* Spacing */
    letter-spacing: -0.5px !important;
    
    /* Remove theme borders */
    border: none !important;
    background: none !important;
}

/* ========================================
   FORM STRUCTURE
   ======================================== */

.super-restaurant-form {
    width: 100%;
}

.super-form-row {
    margin-bottom: 24px;
    width: 100%;
}

.super-form-row:last-child {
    margin-bottom: 0;
}

/* Two column layout */
.super-form-row.super-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Three column layout */
.super-form-row.super-three-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.super-form-field {
    width: 100%;
    display: block;
}

/* ========================================
   LABELS
   ======================================== */

.super-form-field label {
    /* Display */
    display: block;
    margin-bottom: 8px;
    
    /* Typography */
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    line-height: 1.4 !important;
    
    /* Remove theme styles */
    text-transform: none !important;
    letter-spacing: normal !important;
    text-align: left !important;
    border: none !important;
    background: none !important;
    padding: 0 !important;
}

.super-form-field label .required {
    color: #e74c3c;
    margin-left: 3px;
    font-weight: 700;
}

/* ========================================
   INPUT FIELDS (Text, Email, Tel)
   ======================================== */

.super-input {
    /* Layout */
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    
    /* Spacing */
    padding: 14px 16px !important;
    margin: 0 !important;
    
    /* Appearance */
    background: #ffffff !important;
    border: 2px solid #e1e8ed !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    
    /* Typography */
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #333333 !important;
    font-family: inherit !important;
    
    /* Interaction */
    transition: all 0.2s ease !important;
    cursor: text !important;
    
    /* Remove webkit styling */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.super-input::placeholder {
    color: #95a5a6 !important;
    opacity: 1 !important;
}

.super-input:hover {
    border-color: #cbd5e0 !important;
}

.super-input:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1) !important;
    outline: none !important;
}

.super-input:disabled {
    background: #f5f5f5 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* ========================================
   SELECT FIELDS
   ======================================== */

.super-select {
    /* Layout */
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    
    /* Spacing */
    padding: 14px 40px 14px 16px !important;
    margin: 0 !important;
    
    /* Appearance */
    background: #ffffff !important;
    border: 2px solid #e1e8ed !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    
    /* Typography */
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #333333 !important;
    font-family: inherit !important;
    
    /* Interaction */
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    
    /* Remove default arrow */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    
    /* Custom arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1.41 0L6 4.59 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 12px !important;
}

.super-select:hover {
    border-color: #cbd5e0 !important;
}

.super-select:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1) !important;
    outline: none !important;
}

.super-select:disabled {
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Firefox specific */
.super-select:-moz-focusring {
    color: transparent !important;
    text-shadow: 0 0 0 #333333 !important;
}

/* ========================================
   TEXTAREA
   ======================================== */

.super-textarea {
    /* Layout */
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    min-height: 120px !important;
    
    /* Spacing */
    padding: 14px 16px !important;
    margin: 0 !important;
    
    /* Appearance */
    background: #ffffff !important;
    border: 2px solid #e1e8ed !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    
    /* Typography */
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    color: #333333 !important;
    font-family: inherit !important;
    
    /* Interaction */
    transition: all 0.2s ease !important;
    resize: vertical !important;
    
    /* Remove webkit styling */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.super-textarea::placeholder {
    color: #95a5a6 !important;
    opacity: 1 !important;
}

.super-textarea:hover {
    border-color: #cbd5e0 !important;
}

.super-textarea:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1) !important;
    outline: none !important;
}

/* ========================================
   SUBMIT BUTTON
   ======================================== */

.super-submit-button {
    /* Layout */
    width: 100% !important;
    display: block !important;
    
    /* Spacing */
    padding: 16px 32px !important;
    margin: 0 !important;
    
    /* Appearance */
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.25) !important;
    
    /* Typography */
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.5 !important;
    color: #ffffff !important;
    text-align: center !important;
    text-transform: none !important;
    letter-spacing: 0.5px !important;
    font-family: inherit !important;
    
    /* Interaction */
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    
    /* Remove webkit styling */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.super-submit-button:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%) !important;
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.35) !important;
    transform: translateY(-2px) !important;
}

.super-submit-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.25) !important;
}

.super-submit-button:focus {
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.2), 0 4px 12px rgba(39, 174, 96, 0.25) !important;
}

.super-submit-button:disabled {
    background: #95a5a6 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    transform: none !important;
}

/* ========================================
   LOADING STATE
   ======================================== */

.super-form-loading {
    display: none;
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #5a6c7d !important;
    font-size: 15px !important;
}

.super-form-loading.active {
    display: block;
}

.super-form-loading .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(52, 152, 219, 0.2);
    border-left-color: #3498db;
    border-radius: 50%;
    animation: super-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* ========================================
   MESSAGES (Success/Error)
   ======================================== */

.super-form-messages {
    margin-bottom: 24px;
}

.super-message {
    padding: 16px 20px !important;
    margin-bottom: 16px !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    display: flex !important;
    align-items: flex-start !important;
    animation: super-slide-in 0.3s ease-out;
}

.super-message:last-child {
    margin-bottom: 0 !important;
}

/* Success message */
.super-message-success {
    background: #d4edda !important;
    border: 2px solid #c3e6cb !important;
    color: #155724 !important;
}

.super-message-success::before {
    content: "\2713";
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Error message */
.super-message-error {
    background: #f8d7da !important;
    border: 2px solid #f5c6cb !important;
    color: #721c24 !important;
}

.super-message-error::before {
    content: "\2715";
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    flex-shrink: 0;
}

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

/* ========================================
   JQUERY UI DATEPICKER CUSTOMIZATION
   ======================================== */

.ui-datepicker {
    z-index: 9999 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
    font-family: inherit !important;
    background: #ffffff !important;
}

.ui-datepicker-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%) !important;
    color: #ffffff !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 16px 12px !important;
    border: none !important;
}

.ui-datepicker-title {
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    text-align: center !important;
}

.ui-datepicker-prev,
.ui-datepicker-next {
    cursor: pointer !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    transition: background 0.2s !important;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.ui-datepicker-prev span,
.ui-datepicker-next span {
    display: block !important;
    background-color: #ffffff !important;
}

.ui-datepicker table {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: collapse !important;
}

.ui-datepicker th {
    padding: 10px 4px !important;
    text-align: center !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    color: #7f8c8d !important;
    border: none !important;
}

.ui-datepicker td {
    padding: 2px !important;
    border: none !important;
}

.ui-datepicker td a,
.ui-datepicker td span {
    display: block !important;
    padding: 10px !important;
    text-align: center !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    color: #2c3e50 !important;
}

.ui-state-default {
    border: 1px solid transparent !important;
    background: #ffffff !important;
}

.ui-state-default:hover,
.ui-state-hover {
    background: #3498db !important;
    color: #ffffff !important;
    border-color: #3498db !important;
}

.ui-state-active,
.ui-state-active:hover {
    background: #27ae60 !important;
    color: #ffffff !important;
    border-color: #27ae60 !important;
    font-weight: 700 !important;
}

.ui-datepicker .ui-state-disabled,
.ui-datepicker .ui-state-disabled span {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Closed days styling */
.ui-datepicker .closed-day a,
.ui-datepicker .closed-day span {
    background: #ecf0f1 !important;
    color: #95a5a6 !important;
    text-decoration: line-through !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Exception days styling (holidays, special closures) */
.ui-datepicker .exception-day a,
.ui-datepicker .exception-day span {
    background: #fcf0f1 !important;
    color: #d63638 !important;
    text-decoration: line-through !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    border-color: #f8d7da !important;
}

.ui-datepicker .exception-day a::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: #d63638;
    border-radius: 50%;
}

/* ========================================
   TABLET RESPONSIVENESS (max-width: 1024px)
   ======================================== */

@media screen and (max-width: 1024px) {
    .super-restaurant-booking-wrapper {
        padding: 35px;
        margin-bottom: 25px;
    }
    
    .super-restaurant-title {
        font-size: 28px !important;
        margin-bottom: 25px !important;
    }
    
    .super-form-row.super-three-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   MOBILE RESPONSIVENESS (max-width: 768px)
   ======================================== */

@media screen and (max-width: 768px) {
    .super-restaurant-booking-wrapper {
        padding: 30px 25px;
        margin-bottom: 20px;
        border-radius: 8px;
    }
    
    .super-restaurant-title {
        font-size: 26px !important;
        margin-bottom: 24px !important;
    }
    
    /* Stack columns on mobile */
    .super-form-row.super-two-columns,
    .super-form-row.super-three-columns {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .super-form-row {
        margin-bottom: 20px;
    }
    
    /* Adjust input sizes */
    .super-input,
    .super-select {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
    
    .super-textarea {
        min-height: 100px !important;
    }
    
    /* Button adjustments */
    .super-submit-button {
        font-size: 17px !important;
        padding: 14px 28px !important;
    }
}

/* ========================================
   SMALL MOBILE (max-width: 600px)
   ======================================== */

@media screen and (max-width: 600px) {
    .super-restaurant-booking-wrapper {
        padding: 20px;
        margin-bottom: 15px;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #e1e8ed;
        border-bottom: 1px solid #e1e8ed;
    }
    
    .super-restaurant-title {
        font-size: 24px !important;
        margin-bottom: 20px !important;
    }
    
    .super-form-row {
        margin-bottom: 18px;
    }
    
    .super-form-field label {
        font-size: 14px !important;
        margin-bottom: 6px;
    }
    
    /* Compact inputs */
    .super-input,
    .super-select {
        padding: 12px 14px !important;
        font-size: 16px !important;
    }
    
    .super-select {
        padding-right: 36px !important;
        background-position: right 12px center !important;
    }
    
    .super-textarea {
        padding: 12px 14px !important;
        min-height: 90px !important;
    }
    
    .super-submit-button {
        padding: 14px 24px !important;
        font-size: 16px !important;
    }
    
    /* Compact messages */
    .super-message {
        padding: 14px 16px !important;
        font-size: 14px !important;
    }
    
    /* Datepicker adjustments */
    .ui-datepicker {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }
    
    .ui-datepicker td a,
    .ui-datepicker td span {
        padding: 8px !important;
        font-size: 13px !important;
    }
}

/* ========================================
   EXTRA SMALL MOBILE (max-width: 400px)
   ======================================== */

@media screen and (max-width: 400px) {
    .super-restaurant-booking-wrapper {
        padding: 15px;
    }
    
    .super-restaurant-title {
        font-size: 22px !important;
        margin-bottom: 18px !important;
    }
    
    .super-form-field label {
        font-size: 13px !important;
    }
    
    .super-input,
    .super-select,
    .super-textarea {
        font-size: 15px !important;
    }
    
    .super-submit-button {
        font-size: 15px !important;
        padding: 12px 20px !important;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .super-input,
    .super-select,
    .super-textarea {
        min-height: 48px !important;
    }
    
    .super-submit-button {
        min-height: 52px !important;
    }
    
    /* Remove hover effects on touch devices */
    .super-input:hover,
    .super-select:hover,
    .super-textarea:hover {
        border-color: #e1e8ed !important;
    }
    
    .super-submit-button:hover {
        transform: none !important;
    }
}

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

/* Focus visible for keyboard navigation */
.super-input:focus-visible,
.super-select:focus-visible,
.super-textarea:focus-visible {
    outline: 3px solid #3498db !important;
    outline-offset: 2px !important;
}

.super-submit-button:focus-visible {
    outline: 3px solid #27ae60 !important;
    outline-offset: 2px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .super-restaurant-booking-wrapper {
        border: 2px solid #000000;
    }
    
    .super-input,
    .super-select,
    .super-textarea {
        border-width: 3px !important;
    }
    
    .super-submit-button {
        border: 3px solid #000000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body.dark-mode .super-restaurant-booking-wrapper {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    body.dark-mode .super-input,
    body.dark-mode .super-select,
    body.dark-mode .super-textarea {
        background: #34495e !important;
        border-color: #4a5f7f !important;
        color: #ecf0f1 !important;
    }
    
    body.dark-mode .super-form-field label {
        color: #ecf0f1 !important;
    }
}

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

@media print {
    .super-restaurant-booking-wrapper {
        box-shadow: none;
        border: 1px solid #000;
        padding: 20px;
    }
    
    .super-submit-button,
    .super-form-loading {
        display: none !important;
    }
    
    .super-input,
    .super-select,
    .super-textarea {
        border: 1px solid #000 !important;
    }
}

/* ========================================
   THEME-SPECIFIC OVERRIDES
   Common WordPress themes that may conflict
   ======================================== */

/* Override Astra theme */
.ast-container .super-restaurant-booking-wrapper * {
    font-family: inherit !important;
}

/* Override Divi theme */
.et_pb_section .super-restaurant-booking-wrapper * {
    line-height: inherit !important;
}

/* Override Avada theme */
.fusion-body .super-restaurant-booking-wrapper * {
    box-sizing: border-box !important;
}

/* Override Elementor */
.elementor-widget-container .super-restaurant-booking-wrapper * {
    margin: initial;
    padding: initial;
}

/* Override GeneratePress */
.inside-article .super-restaurant-booking-wrapper {
    max-width: 800px !important;
}

/* Override OceanWP */
.entry-content .super-restaurant-booking-wrapper * {
    font-size: inherit !important;
}

/* ========================================
   RTL (Right-to-Left) SUPPORT
   ======================================== */

.rtl .super-restaurant-booking-wrapper,
[dir="rtl"] .super-restaurant-booking-wrapper {
    direction: rtl;
}

.rtl .super-form-field label,
[dir="rtl"] .super-form-field label {
    text-align: right !important;
}

.rtl .super-select,
[dir="rtl"] .super-select {
    background-position: left 14px center !important;
    padding: 14px 16px 14px 40px !important;
}

.rtl .super-message::before,
[dir="rtl"] .super-message::before {
    margin-right: 0;
    margin-left: 12px;
}

/* ========================================
   CUSTOM SCROLLBAR (Webkit browsers)
   ======================================== */

.super-textarea::-webkit-scrollbar {
    width: 8px;
}

.super-textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.super-textarea::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.super-textarea::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.super-hide {
    display: none !important;
}

.super-show {
    display: block !important;
}

.super-text-center {
    text-align: center !important;
}

.super-text-left {
    text-align: left !important;
}

.super-text-right {
    text-align: right !important;
}

/* ========================================
   END OF STYLES
   ======================================== */