/**
 * Public CSS
 * Frontend styling for Bytte Vurdering formular
 *
 * @package Bytte_Vurdering
 * @since 1.0.0
 */

/* ==========================================================================
   Hovedcontainer
   ========================================================================== */

.bytte-vurdering-wrapper {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.bytte-vurdering-wrapper:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Toggle Section
   ========================================================================== */

.bytte-vurdering-toggle {
    margin-bottom: 0;
}

.bytte-vurdering-toggle label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin: 0;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.2s;
}

.bytte-vurdering-toggle label:hover {
    background: rgba(255, 107, 53, 0.05);
}

.bytte-vurdering-toggle input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #FF6B35;
}

.bytte-vurdering-toggle p {
    margin: 10px 0 0 30px;
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Formular Container
   ========================================================================== */

#bytte-vurdering-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

#bytte-vurdering-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #FF6B35;
    font-size: 20px;
    font-weight: 700;
}

/* ==========================================================================
   Form Sections
   ========================================================================== */

.form-section {
    margin-bottom: 25px;
}

.form-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 15px;
}

.form-section label span[style*="color: red"] {
    color: #d9534f;
    margin-left: 3px;
}

/* ==========================================================================
   Input Fields
   ========================================================================== */

#bytte-form input[type="text"],
#bytte-form input[type="email"],
#bytte-form input[type="tel"],
#bytte-form input[type="number"],
#bytte-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
    box-sizing: border-box;
}

#bytte-form input:focus,
#bytte-form textarea:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

#bytte-form input::placeholder {
    color: #999;
}

/* Grid for multiple inputs */
#bytte-form > div[style*="grid"] {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (max-width: 600px) {
    #bytte-form > div[style*="grid"] {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Radio Buttons (Køretøjstype og Stand)
   ========================================================================== */

.radio-label {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.radio-label:hover {
    border-color: #FF6B35;
    background: #fff5f2;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
}

.radio-label input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #FF6B35;
}

.radio-label:has(input:checked) {
    border-color: #FF6B35;
    background: #fff5f2;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Grid for radio options */
.form-section > div[style*="grid"] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

@media (max-width: 600px) {
    .form-section > div[style*="grid"] {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Checkbox (Ryger køretøj)
   ========================================================================== */

#smoker-vehicle-field label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    background: white;
    border-radius: 5px;
    border: 2px solid #ddd;
    transition: all 0.3s;
}

#smoker-vehicle-field label:hover {
    border-color: #FF6B35;
    background: #fff5f2;
}

#smoker-vehicle-field input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #FF6B35;
}

/* ==========================================================================
   File Upload
   ========================================================================== */

#bytte-form input[type="file"] {
    width: 100%;
    padding: 15px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

#bytte-form input[type="file"]:hover {
    border-color: #FF6B35;
    background: #fff5f2;
}

#bytte-form input[type="file"]:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Help text under inputs */
.form-section p[style*="color: #999"],
.form-section p[style*="color: #666"] {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
}

/* ==========================================================================
   Image Preview
   ========================================================================== */

#image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 2px solid #ddd;
    overflow: hidden;
    transition: transform 0.2s;
}

.image-preview-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #d9534f;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    transition: all 0.2s;
    z-index: 10;
}

.image-preview-remove:hover {
    background: #c9302c;
    transform: scale(1.1);
}

/* ==========================================================================
   Video Preview
   ========================================================================== */

#video-preview {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
}

#video-preview p {
    margin: 0;
    color: #5cb85c;
    font-weight: 600;
}

/* ==========================================================================
   Kontaktinfo Section
   ========================================================================== */

#bytte-form > div[style*="background: white"] {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#bytte-form h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

#bytte-submit-btn {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 16px 50px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(255, 107, 53, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#bytte-submit-btn:hover {
    background: #e55a24;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 107, 53, 0.3);
}

#bytte-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(255, 107, 53, 0.2);
}

#bytte-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

#bytte-loading {
    text-align: center;
    padding: 30px;
}

.bytte-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #FF6B35;
    border-radius: 50%;
    animation: bytte-spin 1s linear infinite;
}

@keyframes bytte-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#bytte-loading p {
    margin-top: 15px;
    color: #666;
    font-size: 15px;
    font-weight: 500;
}

/* ==========================================================================
   Success og Error Beskeder
   ========================================================================== */

#bytte-success,
#bytte-error {
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#bytte-success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

#bytte-success strong {
    font-size: 18px;
    display: block;
    margin-bottom: 10px;
}

#bytte-error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

#bytte-error strong {
    font-size: 18px;
    display: block;
    margin-bottom: 10px;
}

#bytte-success p,
#bytte-error p {
    margin: 10px 0 0;
    line-height: 1.6;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .bytte-vurdering-wrapper {
        padding: 15px;
        margin-top: 20px;
    }
    
    #bytte-vurdering-form h3 {
        font-size: 18px;
    }
    
    .radio-label {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    #bytte-submit-btn {
        width: 100%;
        padding: 14px 30px;
    }
    
    #image-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .bytte-vurdering-wrapper {
        padding: 12px;
        border-radius: 5px;
    }
    
    #bytte-form input[type="text"],
    #bytte-form input[type="email"],
    #bytte-form input[type="tel"],
    #bytte-form input[type="number"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-section > div[style*="grid"] {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Print Styling
   ========================================================================== */

@media print {
    .bytte-vurdering-wrapper {
        display: none;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus visible for keyboard navigation */
.bytte-vurdering-wrapper *:focus-visible {
    outline: 3px solid #FF6B35;
    outline-offset: 2px;
}

/* Reduced motion for users with motion sensitivity */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .bytte-vurdering-wrapper {
        background: #1e1e1e;
        border-color: #333;
    }
    
    #bytte-vurdering-form h3 {
        color: #FF8C5A;
    }
    
    .form-section label,
    #bytte-form h4 {
        color: #ddd;
    }
    
    #bytte-form input[type="text"],
    #bytte-form input[type="email"],
    #bytte-form input[type="tel"],
    #bytte-form input[type="number"],
    #bytte-form input[type="file"],
    .radio-label,
    #smoker-vehicle-field label,
    #bytte-form > div[style*="background: white"] {
        background: #2a2a2a;
        color: #ddd;
        border-color: #444;
    }
    
    .radio-label:hover,
    #smoker-vehicle-field label:hover {
        background: #333;
        border-color: #FF8C5A;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.bytte-hidden {
    display: none !important;
}

.bytte-text-center {
    text-align: center;
}

.bytte-mb-0 {
    margin-bottom: 0 !important;
}

.bytte-mt-20 {
    margin-top: 20px !important;
}