/* ORY Smart Product Selector for WordPress */

/* WordPress Theme Integration */
.ory-selector-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* WordPress Admin Bar Adjustment */
.admin-bar .ory-selector-wrapper {
    margin-top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .ory-selector-wrapper {
        margin-top: 46px;
    }
}

/* Main Container */
.smart-selector-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* Header Section */
.ory-header-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
}

.ory-header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.ory-header-content {
    position: relative;
    z-index: 2;
}

.ory-header-section h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.ory-header-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Setup Progress Bar */
.setup-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 30px;
    background: white;
    margin-bottom: 0;
    border-bottom: 1px solid #e9ecef;
}

.setup-step {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
    text-align: center;
    white-space: nowrap;
}

.setup-step::before {
    content: attr(data-setup);
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 8px;
    border: 2px solid transparent;
}

.setup-step.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-color: #0056b3;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.setup-step.active::before {
    background: white;
    color: #007bff;
    border-color: #007bff;
}

.setup-step.completed {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    border-color: #1e7e34;
}

.setup-step.completed::before {
    content: '✓';
    background: white;
    color: #28a745;
    border-color: #28a745;
}

.setup-step.required {
    border-color: #dc3545;
    background: #fff5f5;
}

.setup-step.required.active {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border-color: #c82333;
}

.setup-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Tabs Container */
.tabs-container {
    display: flex;
    min-height: 600px;
    gap: 0;
}

/* Tabs Sidebar */
.tabs-sidebar {
    width: 320px;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    padding: 0;
    overflow-y: auto;
    max-height: 600px;
}

.tab-item {
    display: block;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-right: 4px solid transparent;
}

.tab-item:hover {
    background: #f1f3f4;
    transform: translateX(2px);
}

.tab-item.active {
    background: linear-gradient(90deg, #e3f2fd 0%, white 100%);
    border-right-color: #007bff;
    border-left: 3px solid #007bff;
    box-shadow: inset 4px 0 0 0 #007bff;
}

.tab-item.completed {
    border-right-color: #28a745;
}

.tab-item.required {
    border-right-color: #dc3545;
}

.tab-item.required.active {
    background: linear-gradient(90deg, #fff5f5 0%, white 100%);
    border-right-color: #dc3545;
}

.tab-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tab-title .required-star {
    color: #dc3545;
    font-size: 1.2rem;
    margin-right: 5px;
}

.tab-description {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.4;
}

.tab-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-badge.required {
    background: #dc3545;
    color: white;
}

.tab-badge.optional {
    background: #28a745;
    color: white;
}

/* Tabs Content */
.tabs-content {
    flex: 1;
    background: white;
    padding: 30px;
    overflow-y: auto;
    max-height: 600px;
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Headers */
.section-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #007bff;
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: #28a745;
}

.section-title {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 700;
}

.section-subtitle {
    color: #6c757d;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 0;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: #007bff;
}

.product-card.selected {
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.2);
}

.product-card.selected::before {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    background: #007bff;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 2;
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
}

.product-name {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #2c3e50;
    line-height: 1.3;
}

.product-price {
    color: #28a745;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.product-price::before {
    content: '$';
    font-size: 1rem;
    margin-right: 2px;
}

.product-description {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 15px;
}

.select-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.select-btn.selected {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Smart Navigation */
.smart-navigation {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px 30px;
    border-top: 1px solid #dee2e6;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.nav-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.nav-btn:disabled::before {
    display: none;
}

.prev-btn {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.prev-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6268, #545b62);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.next-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.next-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.complete-btn {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    display: none;
}

.complete-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e7e34, #155724);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.progress-indicator {
    text-align: center;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
}

.progress-text {
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Setup Tips */
.setup-tips {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 20px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.1);
}

.setup-tips h4 {
    color: #856404;
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.setup-tips h4::before {
    content: '💡';
    margin-left: 8px;
    font-size: 1.2rem;
}

.setup-tips ul {
    color: #856404;
    margin: 0;
    padding-right: 20px;
}

.setup-tips li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Sticky Summary */
.sticky-summary {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    border: 2px solid #e9ecef;
    display: none;
    animation: slideInRight 0.3s ease;
}

.sticky-summary.show {
    display: block;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.summary-title {
    font-weight: 700;
    color: #007bff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.summary-title::before {
    content: '🛒';
    margin-left: 8px;
}

.summary-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6c757d;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.summary-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.selected-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.selected-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f4;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.selected-item:last-child {
    border-bottom: none;
}

.selected-item-info {
    flex: 1;
}

.selected-item-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.selected-item-section {
    color: #6c757d;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.selected-item-price {
    color: #28a745;
    font-weight: 600;
    font-size: 0.9rem;
}

.selected-item-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.selected-item-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* WordPress Theme Compatibility */
.ory-selector-wrapper * {
    box-sizing: border-box;
}

/* Remove WordPress defaults that might interfere */
.ory-selector-wrapper p {
    margin-bottom: 1em;
}

.ory-selector-wrapper img {
    height: auto;
    max-width: 100%;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tabs-container {
        flex-direction: column;
    }
    
    .tabs-sidebar {
        width: 100%;
        order: 2;
        max-height: none;
        border-left: none;
        border-top: 1px solid #dee2e6;
    }
    
    .tabs-content {
        order: 1;
        max-height: none;
    }
    
    .tab-item {
        display: inline-block;
        width: calc(50% - 10px);
        margin: 5px;
        border-right: none;
        border-bottom: 2px solid transparent;
    }
    
    .tab-item.active {
        border-bottom-color: #007bff;
        border-left: none;
    }

    .setup-progress {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .setup-step {
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .ory-header-section {
        padding: 30px 20px;
    }
    
    .ory-header-section h1 {
        font-size: 2rem;
    }
    
    .ory-header-section p {
        font-size: 1rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .navigation-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .nav-btn:last-child {
        margin-bottom: 0;
    }
    
    .sticky-summary {
        position: static;
        width: 100%;
        margin-top: 20px;
        transform: none;
    }
    
    .tab-item {
        display: block;
        width: 100%;
        margin: 0;
        border-bottom: 1px solid #e9ecef;
        border-right: none;
    }
}

@media (max-width: 480px) {
    .ory-selector-wrapper {
        padding: 10px;
    }
    
    .ory-header-section {
        padding: 20px 15px;
    }
    
    .ory-header-section h1 {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .tabs-content {
        padding: 20px 15px;
    }
    
    .smart-navigation {
        padding: 20px 15px;
    }
    
    .product-info {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .smart-navigation,
    .sticky-summary,
    .select-btn,
    .nav-btn,
    .setup-progress {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        margin-bottom: 20px;
        border: 1px solid #ddd;
    }
    
    .tab-content {
        display: block !important;
    }
    
    .tabs-sidebar {
        width: 30%;
    }
    
    .tabs-content {
        width: 70%;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .product-card {
        border-width: 3px;
    }
    
    .tab-item {
        border-right-width: 6px;
    }
    
    .nav-btn {
        border: 2px solid currentColor;
    }
}

/* 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;
    }
}