/* ========================================
   Word Tiles Storefront
   Inspired by Letterfolk / Stickermule
   ======================================== */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #DBEAFE;
    --accent: #F59E0B;
    --accent-light: #FEF3C7;
    --dark: #111111;
    --off-white: #FAFAF9;
    --warm-white: #F5F5F4;
    --stone-100: #F5F5F4;
    --stone-200: #E7E5E4;
    --stone-300: #D6D3D1;
    --stone-400: #A8A29E;
    --stone-500: #78716C;
    --stone-600: #57534E;
    --stone-700: #44403C;
    --stone-800: #292524;
    --stone-900: #1C1917;
    --success: #16A34A;
    --danger: #DC2626;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--stone-900);
    background: var(--off-white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

main.container {
    flex: 1;
    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

/* ========== Logo ========== */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none !important;
}

.logo-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
    border: 1.5px solid rgba(255,255,255,0.15);
}

.logo-tile-word {
    background: var(--primary);
    color: #fff;
}

.logo-tile-tiles {
    background: #fff;
    color: var(--dark);
    border-color: rgba(0,0,0,0.08);
}

/* ========== Navbar ========== */
.navbar {
    background: var(--dark);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    transition: all var(--transition);
}

.nav-links a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}

.cart-link {
    color: #fff !important;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
}

.cart-link:hover {
    background: rgba(255,255,255,0.15) !important;
}

/* ========== Messages ========== */
.messages { margin-bottom: 1.5rem; }

.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: var(--accent-light); color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: var(--primary-light); color: #1E40AF; border: 1px solid #BFDBFE; }

/* ========== Cards ========== */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--stone-200);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--stone-900);
    letter-spacing: -0.02em;
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--stone-800);
    letter-spacing: -0.01em;
}

/* ========== Hero Section ========== */
.hero {
    background: var(--dark);
    color: #fff;
    padding: 4rem 0;
    text-align: center;
}

.hero-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.15rem;
    color: rgba(255,255,255,0.7);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ========== Product Photos ========== */
.product-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.product-gallery img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--stone-200);
}

.product-gallery:empty,
.product-gallery.gallery-hidden {
    display: none;
}

@media (max-width: 600px) {
    .product-gallery {
        grid-template-columns: 1fr;
    }
    .product-gallery img {
        height: 220px;
    }
}

/* ========== Forms ========== */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--stone-600);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--stone-300);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: #fff;
    color: var(--stone-900);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none !important;
    transition: all var(--transition);
    line-height: 1.2;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--dark);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-success:hover {
    background: #333;
    box-shadow: var(--shadow);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }

.btn-outline {
    background: #fff;
    color: var(--stone-700);
    border: 1px solid var(--stone-300);
}
.btn-outline:hover {
    background: var(--stone-100);
    border-color: var(--stone-400);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ========== Color Swatches ========== */
.color-swatches {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.color-swatch {
    position: relative;
    cursor: pointer;
}

.color-swatch input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.color-swatch .swatch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 44px;
    border-radius: var(--radius);
    border: 2px solid var(--stone-200);
    font-size: 0.8rem;
    font-weight: 700;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.color-swatch input[type="radio"]:checked + .swatch {
    border-color: var(--dark);
    box-shadow: 0 0 0 2px var(--dark);
    transform: scale(1.05);
}

.color-swatch .swatch:hover {
    border-color: var(--stone-500);
    transform: scale(1.02);
}

/* ========== Tile Preview ========== */
.tile-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.875rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.01em;
}

/* ========== Tables ========== */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.875rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--stone-200);
}

th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--stone-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ========== Tile Builder ========== */
.tile-builder {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.builder-inputs {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

@media (max-width: 600px) {
    .builder-inputs {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 1.75rem;
    }
    .hero {
        padding: 2.5rem 0;
    }
}

.tile-list { margin-top: 1rem; }

.tile-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--stone-100);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: background var(--transition);
}

.tile-list-item:hover {
    background: var(--stone-200);
}

.tile-list-item .word { font-weight: 600; flex: 1; }

.tile-list-item .remove-btn {
    background: none;
    border: none;
    color: var(--stone-400);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    transition: color var(--transition);
    line-height: 1;
}

.tile-list-item .remove-btn:hover {
    color: var(--danger);
}

/* ========== Pricing Tiers ========== */
.pricing-tiers {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.tier-badge {
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--stone-100);
    color: var(--stone-700);
    border: 1px solid var(--stone-200);
    transition: all var(--transition);
}

.tier-badge.active {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
}

/* ========== Pricing Summary ========== */
.pricing-summary {
    border-top: 2px solid var(--stone-200);
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--stone-600);
}

.pricing-row.total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--stone-900);
    border-top: 1px solid var(--stone-200);
    padding-top: 0.875rem;
    margin-top: 0.5rem;
}

.discount-hint {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--accent-light);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: #92400E;
    border: 1px solid #FDE68A;
}

/* ========== Order Status Badge ========== */
.status-badge {
    display: inline-block;
    padding: 0.3rem 0.875rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pending { background: var(--accent-light); color: #92400E; }
.status-paid { background: var(--primary-light); color: #1E40AF; }
.status-generating { background: #E0E7FF; color: #4338CA; }
.status-ready { background: #DCFCE7; color: #166534; }
.status-printing { background: #DBEAFE; color: #1E40AF; }
.status-shipped { background: #DCFCE7; color: #166534; }
.status-cancelled { background: var(--stone-200); color: var(--stone-500); }

/* ========== Success Page ========== */
.success-icon {
    width: 64px;
    height: 64px;
    background: #DCFCE7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--success);
    margin: 0 auto 1.5rem;
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.text-muted { color: var(--stone-500); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ========== Footer ========== */
.footer {
    background: var(--dark);
    color: rgba(255,255,255,0.5);
    padding: 2.5rem 0;
    margin-top: auto;
    text-align: center;
    font-size: 0.85rem;
}

.footer .logo {
    margin-bottom: 0.75rem;
    display: inline-flex;
}

.footer p {
    color: rgba(255,255,255,0.4);
}

/* ========== Quantity Input ========== */
input[type="number"].qty-input {
    width: 70px;
    text-align: center;
    padding: 0.5rem;
}

/* ========== Section Divider ========== */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--stone-400);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--stone-200);
}

/* ========== Feature Pills ========== */
.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

.feature-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
