:root {
    /* Reference Image Inspired Palette - Premium Purple Theme */
    --primary: #6366f1; /* Indigo-Purple */
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-soft: rgba(99, 102, 241, 0.08);
    --secondary: #a855f7; /* Purple-Pink accent */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --accent-blob: rgba(99, 102, 241, 0.15);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    
    --radius-xl: 40px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-premium: 0 25px 50px -12px rgba(99, 102, 241, 0.2);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* Decorative Background Elements */
.bg-blobs {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: floatBlob 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 800px; height: 800px;
    background: radial-gradient(circle, var(--accent-blob) 0%, transparent 70%);
    bottom: -200px; right: -100px;
}

.blob-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
    top: -100px; left: -100px;
    animation-delay: -5s;
}

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Container & Header */
.landing-container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.logo-text {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.04em;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 8px 16px -4px rgba(99, 102, 241, 0.3);
}

/* Split Layout */
.hero-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
    margin-top: 4rem;
    padding-bottom: 8rem;
}

.hero-content {
    animation: slideUp 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-content h1 {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 2rem;
    letter-spacing: -0.05em;
    background: linear-gradient(to bottom right, var(--text-main), #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content .subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3.5rem;
    max-width: 520px;
    line-height: 1.8;
}

/* Action Buttons */
.cta-group {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1.4rem 3rem;
    border-radius: 99px;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px -10px rgba(99, 102, 241, 0.5);
}

/* Right Side Illustration Area */
.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 1.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.visual-card-stack {
    position: relative;
    width: 100%;
    max-width: 540px;
    animation: float 6s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.module-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--glass-border);
    text-decoration: none;
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2rem;
}

.module-card:hover {
    transform: scale(1.03) translateX(10px);
    background: white;
    box-shadow: var(--shadow-premium);
    border-color: var(--primary-light);
}

.module-card h3 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 0.8rem;
    font-weight: 800;
}

.module-card p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.icon-circle {
    flex-shrink: 0;
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--primary-soft), transparent);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 1px solid var(--glass-border);
}

/* Footer & Social */
.landing-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4rem 0;
    margin-top: auto;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.social-links {
    display: flex;
    gap: 2rem;
}

.social-links a {
    color: var(--text-muted);
    font-size: 1.4rem;
    transition: all 0.3s;
    text-decoration: none;
}

.social-links a:hover { color: var(--primary); transform: translateY(-3px); }

.admin-pill {
    padding: 0.8rem 1.8rem;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: var(--shadow-glass);
}

.admin-pill:hover { background: var(--text-main); color: white; transform: translateY(-2px); }

/* Login Page Enhancement */
.login-container { 
    margin: auto; 
    width: 100%;
    max-width: 500px; 
    padding: 2rem;
    animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.login-card { 
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 4rem; 
    border-radius: var(--radius-xl); 
    box-shadow: var(--shadow-premium); 
    border: 1px solid var(--glass-border); 
}

.login-card h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: -0.03em;
}

.login-card .subtitle {
    text-align: center;
    margin-bottom: 3.5rem;
}

.form-group { margin-bottom: 2rem; }
.form-group label { 
    display: block; 
    font-size: 0.9rem; 
    font-weight: 600; 
    margin-bottom: 0.8rem;
    color: var(--text-main);
}

input { 
    width: 100%; 
    padding: 1.1rem 1.5rem; 
    border-radius: var(--radius-md); 
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s; 
    font-size: 1rem;
}

input:focus { 
    outline: none; 
    border-color: var(--primary-light); 
    background: white;
    box-shadow: 0 0 0 5px var(--primary-soft); 
}

.login-card button {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 15px 30px -8px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
}

.login-card button:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -8px rgba(99, 102, 241, 0.5);
}

/* Dashboard & Common Elements (Unified with Landing) */
.container { max-width: 1300px; margin: 0 auto; padding: 2rem; }
.topbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 3rem; 
    background: white;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--glass-border);
}

.topbar h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.topbar .subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

.link-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.link-btn.primary {
    background: var(--primary);
    color: white;
}

.link-btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.link-btn.secondary {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.link-btn.secondary:hover {
    background: white;
    box-shadow: var(--shadow-glass);
    transform: translateY(-2px);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.stat-card { 
    background: white; 
    padding: 2rem; 
    border-radius: var(--radius-lg); 
    border: 1px solid rgba(0,0,0,0.03); 
    box-shadow: var(--shadow-glass);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.stat-card:hover { 
    transform: translateY(-8px); 
    box-shadow: var(--shadow-premium);
}
.stat-card .label { 
    font-size: 0.8rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    letter-spacing: 0.05em; 
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.stat-card .value { 
    font-size: 2.25rem; 
    font-weight: 900; 
    color: var(--primary); 
    letter-spacing: -0.02em;
}

.card { 
    background: white; 
    padding: 2.5rem; 
    border-radius: var(--radius-lg); 
    border: 1px solid rgba(0,0,0,0.03); 
    margin-bottom: 2.5rem; 
    box-shadow: var(--shadow-glass); 
    position: relative;
    overflow: visible;
}

.card h2 { 
    font-size: 1.5rem; 
    font-weight: 800; 
    margin-bottom: 2rem; 
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Data Tables */
.table-container { 
    overflow-x: auto; 
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0;
}

th { 
    background: #f8fafc; 
    padding: 1.25rem 1rem; 
    font-size: 0.85rem; 
    font-weight: 700; 
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #f1f5f9;
}

td { 
    padding: 1.25rem 1rem; 
    border-bottom: 1px solid #f1f5f9; 
    font-size: 0.95rem; 
    color: var(--text-main);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbfcfe; }

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Form Elements */
.grid { display: grid; gap: 1.5rem; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.two > * {
    min-width: 0;
}

.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.nav-tabs a {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.nav-tabs a.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

input, select, textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-soft);
}

button[type="submit"] {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

button.danger {
    background: #ef4444;
}

button.danger:hover {
    background: #dc2626;
}

/* Custom Search Box */
.search-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-wrapper i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-wrapper input {
    padding-left: 3rem;
}

/* --- Optional: owner sales report 3-up stats (use with class on wrapper) --- */
.stat-grid--cols-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

/* Product pickers: desktop height; phones use max-height + scroll */
.select-product-list {
    width: 100%;
    height: 250px;
    max-height: min(250px, 42vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.select-product-list--compact {
    height: auto !important;
    min-height: 140px;
    max-height: min(200px, 40vh) !important;
}

.table-container--scroll {
    max-height: min(450px, 55vh);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Wide tables: horizontal scroll on small screens instead of squashing */
.table-scroll-min {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-min table {
    min-width: 620px;
}

/* Toast messages (owner / staff app) */
.flash.flash--toast {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 10000;
    margin: 0;
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 100%;
    box-sizing: border-box;
}

.flash.flash--toast.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash.flash--toast.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash.flash--toast:not(.success):not(.error) {
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

/* Wholesale deliver row: stacks on narrow screens */
.wholesale-actions-grid {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    margin: 0;
    align-items: center;
}

/* =============================================================================
   Responsive — phones & small tablets
   ============================================================================= */

html {
    -webkit-text-size-adjust: 100%;
}

button,
.link-btn,
.admin-pill,
.btn-primary,
input[type="submit"] {
    touch-action: manipulation;
}

/* Tablets & small laptops — owner portal, shop/salon app */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        width: 100%;
        padding: 1rem max(12px, env(safe-area-inset-left, 0px)) 2rem max(12px, env(safe-area-inset-right, 0px));
        box-sizing: border-box;
    }

    .stat-grid,
    .stat-grid--cols-3 {
        grid-template-columns: 1fr !important;
    }

    .grid.two {
        grid-template-columns: 1fr !important;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem 1rem;
    }

    .topbar h1 {
        font-size: 1.35rem;
        word-wrap: break-word;
    }

    .topbar-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
        gap: 0.65rem;
    }

    .topbar-actions .link-btn,
    .topbar-actions form,
    .topbar-actions button[type="submit"] {
        width: 100% !important;
        max-width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    .nav-tabs a {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        text-align: center;
        font-size: 0.8rem;
        padding: 0.65rem 0.5rem;
    }

    .card {
        padding: 1.25rem 1rem;
        margin-bottom: 1.25rem;
    }

    .card h2 {
        font-size: 1.2rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .table-container {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 0;
    }

    .table-container--scroll {
        max-height: min(400px, 50vh);
    }

    .landing-container {
        max-width: 100%;
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
    }

    .hero-content h1 {
        font-size: clamp(2rem, 7vw, 3.25rem);
        word-break: break-word;
    }
}

@media (max-width: 1100px) {
    .hero-split {
        grid-template-columns: 1fr;
        gap: 3rem;
        margin-top: 2rem;
        padding-bottom: 4rem;
    }

    .hero-visual {
        order: -1;
    }

    .hero-content h1 {
        font-size: clamp(2.25rem, 8vw, 3.75rem);
    }

    .visual-card-stack {
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    .stat-grid--cols-3 {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem 1rem 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .card h2 {
        font-size: 1.25rem;
        flex-wrap: wrap;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem 1.25rem;
        margin-bottom: 2rem;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .topbar-actions form,
    .topbar-actions .link-btn {
        width: auto;
        flex: 1 1 auto;
        min-width: min(100%, 140px);
    }

    .stat-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card .value {
        font-size: 1.75rem;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }

    .nav-tabs {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        box-sizing: border-box;
    }

    .nav-tabs a {
        flex: 1 1 auto;
        text-align: center;
        min-width: 0;
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .table-container {
        -webkit-overflow-scrolling: touch;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .wholesale-actions-grid {
        grid-template-columns: 1fr;
    }

    .wholesale-actions-grid button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .landing-container {
        padding: 0 1rem;
    }

    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem 0;
        margin-bottom: 1rem;
    }

    .cta-group {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        text-align: center;
        padding: 1.1rem 1.5rem;
    }

    .module-card {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1.25rem;
    }

    .module-card:hover {
        transform: none;
    }

    .module-card h3 {
        font-size: 1.35rem;
    }

    .landing-footer {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        padding: 2.5rem 0;
    }

    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-card h1 {
        font-size: 1.75rem;
    }

    .blob-1,
    .blob-2 {
        width: min(100vw, 420px);
        height: min(100vw, 420px);
    }

    .select-product-list {
        height: auto;
        min-height: 160px;
        max-height: 38vh;
    }
}

@media (max-width: 480px) {
    .hero-content .subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .icon-circle {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .login-card button {
        font-size: 1rem;
        padding: 1rem;
    }

    button[type="submit"] {
        width: 100%;
        max-width: 100%;
    }

    .link-btn {
        justify-content: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .topbar-actions .link-btn {
        width: 100%;
    }
}
