/* Aethel Premium Commerce 2030 - Styles */

:root {
    --bg-color: #0a0a0a;
    --text-color: #f5f5f7;
    --text-muted: #86868b;
    --accent-color: #d4af37; /* Gold accent */
    --border-color: #333;
    --panel-bg: rgba(25, 25, 25, 0.8);
    --btn-bg: #f5f5f7;
    --btn-text: #0a0a0a;
    --btn-hover: #e0e0e0;
    --error-color: #ff453a;
    --success-color: #32d74b;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
    /* We force dark mode for the premium feel, but respect light mode if strictly needed. 
       Actually, premium brands often stick to their brand world. Let's keep it dark mode default, 
       but add a light theme just in case. */
    :root {
        --bg-color: #f5f5f7;
        --text-color: #1d1d1f;
        --text-muted: #86868b;
        --panel-bg: rgba(255, 255, 255, 0.8);
        --btn-bg: #1d1d1f;
        --btn-text: #f5f5f7;
        --btn-hover: #333;
        --border-color: #d2d2d7;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }

.hidden { display: none !important; }

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

select, button, input {
    font-family: inherit;
    font-size: 1rem;
}

select {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

button {
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-color);
}

.primary-btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    width: 100%;
    transition: transform 0.2s, background 0.2s;
}

.primary-btn:hover {
    background: var(--btn-hover);
    transform: scale(1.02);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Main Layout */
main {
    padding-top: 5rem; /* offset header */
}

.hero-configurator {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 5rem);
}

@media (min-width: 768px) {
    .hero-configurator {
        flex-direction: row;
    }
}

.canvas-container {
    flex: 1;
    position: relative;
    min-height: 50vh;
    background: radial-gradient(circle at center, rgba(255,255,255,0.05) 0%, transparent 70%);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

.config-panel {
    flex: 1;
    padding: 2rem;
    max-width: 500px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.price {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.options-group {
    margin-bottom: 2rem;
}

.options-group h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-btn {
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    transition: all 0.2s;
}

.option-btn.active {
    border-color: var(--text-color);
    background: var(--text-color);
    color: var(--bg-color);
}

.option-btn:disabled {
    opacity: 0.3;
    text-decoration: line-through;
    cursor: not-allowed;
}

.stock-status {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--success-color);
}
.stock-status.out {
    color: var(--error-color);
}

#engraving-text {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
}

/* Related Products */
.related-products {
    padding: 4rem 2rem;
    border-top: 1px solid var(--border-color);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.product-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card h3 {
    margin: 1rem 0 0.5rem;
}

.product-card button {
    margin-top: 1rem;
    text-decoration: underline;
}

/* Cart Drawer */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-details h4 {
    margin-bottom: 0.25rem;
}

.cart-item-options {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-controls button {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-total {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.promo-code {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.promo-code input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
}

.promo-code button {
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.progress-bar-container {
    background: var(--border-color);
    height: 4px;
    border-radius: 2px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.85rem;
    text-align: center;
    color: var(--accent-color);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-color);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
}

.checkout-step {
    display: none;
}
.checkout-step.active {
    display: block;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
}

.form-group input:invalid {
    border-color: var(--error-color);
}

.error-msg {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

/* AI Assistant Widget */
.ai-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 150;
}

.ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--text-color);
    color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.3s;
}

.ai-toggle:hover {
    transform: scale(1.1);
}

.ai-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 400px;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-panel.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.ai-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.ai-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-msg {
    background: rgba(255,255,255,0.1);
    padding: 0.75rem;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.9rem;
}

.user-msg {
    background: var(--text-color);
    color: var(--bg-color);
    align-self: flex-end;
}

.ai-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.ai-input input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 20px;
}

/* Gamification Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--accent-color);
    color: #000;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.ai-typing {
    animation: pulse 1s infinite;
}
