/**
 * AHH Home Visualizer Frontend Styles
 * Supports Interior, Exterior, and Floorplan Staging
 */

/* Stage Button */
.ahh-personalize-wrapper {
    margin: 20px 0;
    text-align: center;
}

.ahh-personalize-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #2c5282 0%, #1a365d 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 82, 130, 0.3);
}

.ahh-personalize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 82, 130, 0.4);
}

.ahh-personalize-btn:active {
    transform: translateY(0);
}

.ahh-btn-icon {
    font-size: 20px;
}

/* Card Button (icon in corner of images) */
.ahh-card-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure card container has relative positioning for button placement */
a.home-designs-card,
.home-designs-card {
    position: relative !important;
    display: block;
}

.ahh-card-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
}

.ahh-card-btn .ahh-btn-icon {
    font-size: 20px;
    margin: 0;
}

/* Hide text label on card buttons, show only icon */
.ahh-card-btn .ahh-btn-text {
    display: none;
}

/* Show button on card/image hover */
article:hover .ahh-card-btn,
a.home-designs-card:hover .ahh-card-btn,
.home-designs-card:hover .ahh-card-btn,
.home-design-card:hover .ahh-card-btn,
.plan-card:hover .ahh-card-btn,
.property-card:hover .ahh-card-btn,
*:hover > .ahh-card-btn {
    opacity: 0.75;
    transform: scale(1);
}

/* Full opacity on direct button hover */
article:hover .ahh-card-btn:hover,
a.home-designs-card:hover .ahh-card-btn:hover,
.home-designs-card:hover .ahh-card-btn:hover,
.home-design-card:hover .ahh-card-btn:hover,
.plan-card:hover .ahh-card-btn:hover,
.property-card:hover .ahh-card-btn:hover,
*:hover > .ahh-card-btn:hover {
    opacity: 1;
}

/* Tooltip on hover */
.ahh-card-btn::after {
    content: 'Stage It!';
    position: absolute;
    top: 50%;
    right: calc(100% + 8px);
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ahh-card-btn:hover::after {
    opacity: 1;
}

/* Always visible on touch devices */
@media (hover: none) {
    .ahh-card-btn {
        opacity: 0.6;
        transform: scale(1);
    }

    .ahh-card-btn::after {
        display: none;
    }
}

/* Modal Overlay */
body.ahh-modal-open {
    overflow: hidden;
}

.ahh-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ahh-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.ahh-modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ahh-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.ahh-modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Modal Content */
.ahh-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.ahh-form-step {
    display: none;
}

.ahh-form-step.active {
    display: block;
}

.ahh-form-step h2 {
    margin: 0 0 8px;
    font-size: 24px;
    color: #1e293b;
}

.ahh-step-description {
    margin: 0 0 24px;
    color: #64748b;
    font-size: 15px;
}

/* Image Type Tabs */
.ahh-image-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 6px;
    background: #f1f5f9;
    border-radius: 12px;
}

.ahh-type-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    font-weight: 500;
    font-size: 14px;
}

.ahh-type-tab:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #475569;
}

.ahh-type-tab.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ahh-tab-icon {
    font-size: 18px;
}

.ahh-tab-label {
    font-weight: 600;
}

/* Type Options Containers */
.ahh-type-options {
    display: none;
}

.ahh-type-options.active {
    display: block;
}

/* Form Elements */
.ahh-form-group {
    margin-bottom: 24px;
}

.ahh-form-group > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #374151;
    font-size: 15px;
}

/* Required/Optional Labels */
.ahh-required {
    color: #ef4444;
}

.ahh-optional {
    font-weight: 400;
    color: #6b7280;
    font-size: 13px;
}

/* Style Grid - 5 columns on desktop, 2 on mobile */
.ahh-style-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.ahh-style-card {
    position: relative;
    cursor: pointer;
}

.ahh-style-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ahh-style-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
}

.ahh-style-card:hover .ahh-style-card-content {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.ahh-style-card input[type="radio"]:checked + .ahh-style-card-content {
    border-color: #2c5282;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}

.ahh-style-card input[type="radio"]:focus + .ahh-style-card-content {
    outline: 2px solid #2c5282;
    outline-offset: 2px;
}

.ahh-style-icon {
    font-size: 28px;
    margin-bottom: 8px;
    line-height: 1;
}

.ahh-style-name {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 4px;
}

.ahh-style-desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

/* Color Palette Group */
.ahh-color-palette-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ahh-color-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 140px;
}

.ahh-color-option:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.ahh-color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ahh-color-option:has(input[type="radio"]:checked) {
    border-color: #2c5282;
    background: #eff6ff;
}

/* For browsers that don't support :has() */
.ahh-color-option.selected {
    border-color: #2c5282;
    background: #eff6ff;
}

.ahh-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

/* Color swatch gradients - Interior */
.ahh-swatch-default {
    background: conic-gradient(
        from 0deg,
        #8b7355 0deg,
        #6b8e23 72deg,
        #4682b4 144deg,
        #daa520 216deg,
        #cd853f 288deg,
        #8b7355 360deg
    );
}

.ahh-swatch-warm {
    background: linear-gradient(135deg, #dc2626 0%, #f97316 33%, #d97706 66%, #fef3c7 100%);
}

.ahh-swatch-cool {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 33%, #7c3aed 66%, #d1d5db 100%);
}

.ahh-swatch-neutral {
    background: linear-gradient(135deg, #d6d3d1 0%, #a8a29e 33%, #78716c 66%, #f5f5f4 100%);
}

.ahh-swatch-bold {
    background: linear-gradient(135deg, #dc2626 0%, #7c3aed 25%, #0891b2 50%, #16a34a 75%, #eab308 100%);
}

/* Color swatch gradients - Exterior */
.ahh-swatch-earth {
    background: linear-gradient(135deg, #78350f 0%, #a16207 33%, #15803d 66%, #78716c 100%);
}

.ahh-swatch-classic {
    background: linear-gradient(135deg, #ffffff 0%, #166534 33%, #991b1b 66%, #1e3a8a 100%);
}

.ahh-swatch-vibrant {
    background: linear-gradient(135deg, #ec4899 0%, #f97316 25%, #eab308 50%, #22c55e 75%, #8b5cf6 100%);
}

.ahh-swatch-monochrome {
    background: linear-gradient(135deg, #166534 0%, #22c55e 33%, #86efac 66%, #dcfce7 100%);
}

.ahh-color-label {
    font-weight: 500;
    font-size: 14px;
    color: #374151;
}

/* Pill Option Groups (for Season, Time, etc.) */
.ahh-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.ahh-option-group {
    flex: 1;
    min-width: 200px;
}

.ahh-option-group > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.ahh-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ahh-pill {
    cursor: pointer;
}

.ahh-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ahh-pill span {
    display: inline-block;
    padding: 8px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s ease;
}

.ahh-pill:hover span {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.ahh-pill input[type="radio"]:checked + span {
    border-color: #2c5282;
    background: #eff6ff;
    color: #1e40af;
}

/* Saved Preferences Notice */
.ahh-saved-prefs-notice {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 13px;
    color: #166534;
}

.ahh-saved-prefs-notice p {
    margin: 0;
}

.ahh-saved-prefs-notice a {
    color: #15803d;
    text-decoration: underline;
    margin-left: 8px;
}

.ahh-saved-prefs-notice a:hover {
    color: #166534;
}

/* Result Display */
.ahh-result-step h2 {
    text-align: center;
}

/* Before/After Comparison */
.ahh-result-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.ahh-comparison-item {
    position: relative;
    text-align: center;
}

.ahh-comparison-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
}

.ahh-comparison-item img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

/* Image Wrapper with Hover Overlay */
.ahh-image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.ahh-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ahh-image-wrapper:hover .ahh-image-overlay {
    opacity: 1;
}

.ahh-overlay-btn,
.ahh-zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    text-decoration: none;
    color: #1e293b;
}

.ahh-overlay-btn:hover,
.ahh-zoom-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

/* Zoom Modal */
.ahh-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ahh-zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.ahh-zoom-container {
    position: relative;
    width: 95%;
    height: 95%;
    display: flex;
    flex-direction: column;
}

.ahh-zoom-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 28px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.ahh-zoom-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ahh-zoom-content {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ahh-zoom-content img {
    max-width: none;
    transition: transform 0.2s ease;
    cursor: grab;
}

.ahh-zoom-content img:active {
    cursor: grabbing;
}

.ahh-zoom-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
}

.ahh-zoom-control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.ahh-zoom-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#ahh-zoom-reset {
    width: auto;
    padding: 0 16px;
    font-size: 14px;
}

#ahh-zoom-level {
    color: #fff;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
}

.ahh-result-image-container {
    margin: 20px 0;
    text-align: center;
}

.ahh-result-image-container img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.ahh-result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.ahh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.ahh-btn-primary {
    background: linear-gradient(135deg, #2c5282 0%, #1a365d 100%);
    color: #fff;
}

.ahh-btn-primary:hover {
    box-shadow: 0 4px 15px rgba(44, 82, 130, 0.4);
    transform: translateY(-1px);
}

.ahh-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.ahh-btn-secondary:hover {
    background: #e2e8f0;
}

.ahh-btn-outline {
    background: transparent;
    border: 2px solid #d1d5db;
    color: #64748b;
}

.ahh-btn-outline:hover {
    border-color: #2c5282;
    color: #2c5282;
}

/* Form Navigation */
.ahh-form-navigation {
    display: flex;
    justify-content: center;
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.ahh-form-navigation .ahh-btn {
    min-width: 180px;
}

/* Loading Overlay */
.ahh-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.ahh-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #2c5282;
    border-radius: 50%;
    animation: ahh-spin 1s linear infinite;
}

@keyframes ahh-spin {
    to {
        transform: rotate(360deg);
    }
}

.ahh-loading-text {
    margin: 20px 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.ahh-loading-subtext {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

/* Responsive */
@media (max-width: 900px) {
    .ahh-style-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .ahh-options-row {
        flex-direction: column;
        gap: 16px;
    }

    .ahh-option-group {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .ahh-modal-container {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .ahh-modal-content {
        padding: 20px;
    }

    .ahh-image-type-tabs {
        flex-direction: column;
        gap: 4px;
    }

    .ahh-type-tab {
        justify-content: flex-start;
        padding: 10px 14px;
    }

    .ahh-style-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .ahh-style-card-content {
        padding: 12px 8px;
        min-height: 100px;
    }

    .ahh-style-icon {
        font-size: 24px;
    }

    .ahh-style-name {
        font-size: 12px;
    }

    .ahh-style-desc {
        font-size: 10px;
    }

    .ahh-color-palette-group {
        flex-direction: column;
    }

    .ahh-color-option {
        width: 100%;
        min-width: auto;
    }

    .ahh-pill-group {
        gap: 6px;
    }

    .ahh-pill span {
        padding: 6px 12px;
        font-size: 12px;
    }

    .ahh-form-navigation {
        padding: 15px 20px;
    }

    .ahh-result-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ahh-comparison-label {
        font-size: 11px;
        padding: 4px 10px;
    }

    .ahh-result-actions {
        flex-direction: column;
    }

    .ahh-result-actions .ahh-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ahh-style-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ahh-style-desc {
        display: none;
    }

    .ahh-style-card-content {
        min-height: 80px;
    }
}
