/**
 * Unified Template Styles for AppMiNegocio
 * 
 * This file contains all visual template variations used across:
 * - Constructor gallery preview (uses .template-app wrapper)
 * - Guest demo preview (uses .preview-app wrapper)  
 * - Production app (uses body.template-X)
 * 
 * Template IDs:
 * 1 = Classic (default)
 * 2 = Modern (dark, minimal)
 * 3 = Elegant (serif, golden accents)
 * 4 = Fresh (rounded, turquoise)
 * 5 = Energetic (bold, athletic)
 * 
 * NOTE: Selectors use both .template-app and body for cross-file compatibility
 */

/* =============================================
   CSS Variables for Templates
   ============================================= */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
}

/* =============================================
   BASE TEMPLATE STYLES (Classic - ID: 1)
   ============================================= */

/* App container */
.template-app {
    min-height: 100%;
    background: #f8f9fa;
    color: #1a1a2e;
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Override global main.css styles that interfere with template rendering */
.template-app a {
    color: inherit;
}

.template-app .section {
    padding: 1.5rem 1rem;
}

.template-app h1,
.template-app h2,
.template-app h3,
.template-app p {
    margin-bottom: 0;
    color: inherit;
}

/* Header */
.template-app .app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    padding-top: max(2rem, env(safe-area-inset-top));
}

/* Logo */
.template-app .app-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 1rem;
    margin: 0 auto 1rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.template-app .app-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Business name and description */
.template-app .app-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.template-app .app-description {
    opacity: 0.9;
    font-size: 0.9375rem;
}

/* Contact bar */
.template-app .contact-bar {
    display: flex;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.template-app .contact-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    text-decoration: none;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.2s;
}

.template-app .contact-item:active {
    background: #f8f9fa;
}

.template-app .contact-item svg {
    margin-bottom: 0.25rem;
}

/* Section */
.template-app .section {
    padding: 1.5rem 1rem;
}

.template-app .section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1a1a2e;
}

/* Product list */
.template-app .product-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Product card */
.template-app .product-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
}

.template-app .product-image {
    width: 100px;
    height: 100px;
    background: #e9ecef;
    flex-shrink: 0;
}

.template-app .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-app .product-info {
    padding: 0.75rem 1rem;
    flex: 1;
}

.template-app .product-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    color: #1a1a2e;
}

.template-app .product-description {
    font-size: 0.8125rem;
    color: #6c757d;
    line-height: 1.4;
}

.template-app .product-price {
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* Booking button */
.template-app .btn-book {
    display: block;
    width: calc(100% - 2rem);
    margin: 0 1rem 1rem;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

/* =============================================
   TEMPLATE: MODERN (ID: 2)
   Dark theme, minimal, tech-forward
   ============================================= */
.template-app.template-modern {
    background: #111827;
    color: #f3f4f6;
    font-family: 'Inter', sans-serif;
}

.template-app.template-modern .app-header {
    background: #1f2937;
    text-align: left;
    padding-bottom: 3rem;
}

.template-app.template-modern .app-logo {
    margin: 0 0 1rem 0;
    border-radius: 12px;
    box-shadow: none;
    background: #374151;
}

.template-app.template-modern .app-name {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.25rem;
}

.template-app.template-modern .contact-bar {
    background: #1f2937;
    border-bottom: 1px solid #374151;
    margin-top: -1px;
}

.template-app.template-modern .contact-item {
    color: #9ca3af;
}

.template-app.template-modern .section-title {
    color: #f3f4f6;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.template-app.template-modern .product-card {
    background: #1f2937;
    border: 1px solid #374151;
    box-shadow: none;
}

.template-app.template-modern .product-title {
    color: #f3f4f6;
}

.template-app.template-modern .product-description {
    color: #9ca3af;
}

.template-app.template-modern .product-image {
    background: #374151;
}

/* =============================================
   TEMPLATE: ELEGANT (ID: 3)
   Serif fonts, refined borders, premium feel
   ============================================= */
.template-app.template-elegant {
    background: #fafafa;
    font-family: 'Playfair Display', serif;
}

.template-app.template-elegant .app-header {
    background: white;
    color: #1a1a2e;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
}

.template-app.template-elegant .app-logo {
    border-radius: 50%;
    border: 2px solid var(--primary);
    padding: 5px;
}

.template-app.template-elegant .app-name {
    font-size: 2rem;
    font-weight: 700;
    font-style: italic;
    color: #1a1a2e;
}

.template-app.template-elegant .app-description {
    color: #666;
    opacity: 1;
}

.template-app.template-elegant .contact-bar {
    background: transparent;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.template-app.template-elegant .contact-item {
    flex: 0 0 auto;
    color: #1a1a2e;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
}

.template-app.template-elegant .section-title {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem;
    color: #999;
    font-family: 'Inter', sans-serif;
}

.template-app.template-elegant .product-card {
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: none;
    border-radius: 2px;
}

.template-app.template-elegant .btn-book {
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
}

/* =============================================
   TEMPLATE: FRESH (ID: 4)
   Rounded corners, soft shadows, health/wellness
   ============================================= */
.template-app.template-fresh {
    background: #f0fdf4;
    font-family: 'Inter', sans-serif;
}

.template-app.template-fresh .app-header {
    border-radius: 0 0 2.5rem 2.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.template-app.template-fresh .contact-bar {
    background: white;
    width: 90%;
    margin: -2rem auto 1rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: none;
    position: relative;
    z-index: 10;
}

.template-app.template-fresh .product-card {
    border-radius: 1.5rem;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.template-app.template-fresh .product-image {
    border-radius: 1.5rem;
    margin: 0.5rem;
    height: 90px;
    width: 90px;
}

.template-app.template-fresh .btn-book {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 2rem;
}

/* =============================================
   TEMPLATE: ENERGETIC (ID: 5)
   Bold angles, strong contrast, sports/fitness
   ============================================= */
.template-app.template-energetic {
    font-family: 'Montserrat', sans-serif;
    background: #fff;
}

.template-app.template-energetic .app-header {
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
    padding-bottom: 4rem;
    text-transform: uppercase;
}

.template-app.template-energetic .app-logo {
    border-radius: 0;
    transform: rotate(-3deg);
    border: 4px solid white;
}

.template-app.template-energetic .app-name {
    font-weight: 800;
    font-style: italic;
    font-size: 1.8rem;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
}

.template-app.template-energetic .product-card {
    border-radius: 0;
    border-left: 5px solid var(--primary);
}

.template-app.template-energetic .btn-book {
    border-radius: 0;
    transform: skew(-10deg);
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.9);
    transition: transform 0.1s, box-shadow 0.1s;
}

.template-app.template-energetic .btn-book:active {
    transform: skew(-10deg) translate(2px, 2px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.9);
}

/* =============================================
   BODY-LEVEL TEMPLATE STYLES
   For production app that applies class to <body>
   ============================================= */

/* Modern on body */
body.template-modern {
    background: #111827;
    color: #f3f4f6;
    font-family: 'Inter', sans-serif;
}

body.template-modern .app-header {
    background: #1f2937;
    text-align: left;
    padding-bottom: 3rem;
}

body.template-modern .app-logo {
    margin: 0 0 1rem 0;
    border-radius: 12px;
    box-shadow: none;
    background: #374151;
}

body.template-modern .contact-bar {
    background: #1f2937;
    border-bottom: 1px solid #374151;
}

body.template-modern .contact-item {
    color: #9ca3af;
}

body.template-modern .section-title {
    color: #f3f4f6;
}

body.template-modern .product-card {
    background: #1f2937;
    border: 1px solid #374151;
    box-shadow: none;
}

body.template-modern .product-title {
    color: #f3f4f6;
}

body.template-modern .product-description {
    color: #9ca3af;
}

/* Elegant on body */
body.template-elegant {
    background: #fafafa;
    font-family: 'Playfair Display', serif;
}

body.template-elegant .app-header {
    background: white;
    color: #1a1a2e;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
}

body.template-elegant .app-logo {
    border-radius: 50%;
    border: 2px solid var(--primary);
    padding: 5px;
}

body.template-elegant .app-name {
    font-size: 2rem;
    font-style: italic;
    color: #1a1a2e;
}

body.template-elegant .contact-bar {
    background: transparent;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

body.template-elegant .contact-item {
    flex: 0 0 auto;
    color: #1a1a2e;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
}

body.template-elegant .product-card {
    border: 1px solid #e5e7eb;
    box-shadow: none;
    border-radius: 2px;
}

body.template-elegant .btn-book {
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
}

/* Fresh on body */
body.template-fresh {
    background: #f0fdf4;
    font-family: 'Inter', sans-serif;
}

body.template-fresh .app-header {
    border-radius: 0 0 2.5rem 2.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

body.template-fresh .contact-bar {
    background: white;
    width: 90%;
    margin: -2rem auto 1rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: none;
    position: relative;
    z-index: 10;
}

body.template-fresh .product-card {
    border-radius: 1.5rem;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

body.template-fresh .product-image {
    border-radius: 1.5rem;
    margin: 0.5rem;
    height: 90px;
    width: 90px;
}

body.template-fresh .btn-book {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 2rem;
}

/* Energetic on body */
body.template-energetic {
    font-family: 'Montserrat', sans-serif;
    background: #fff;
}

body.template-energetic .app-header {
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
    padding-bottom: 4rem;
    text-transform: uppercase;
}

body.template-energetic .app-logo {
    border-radius: 0;
    transform: rotate(-3deg);
    border: 4px solid white;
}

body.template-energetic .app-name {
    font-weight: 800;
    font-style: italic;
    font-size: 1.8rem;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
}

body.template-energetic .product-card {
    border-radius: 0;
    border-left: 5px solid var(--primary);
}

body.template-energetic .btn-book {
    border-radius: 0;
    transform: skew(-10deg);
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.9);
}

body.template-energetic .btn-book:active {
    transform: skew(-10deg) translate(2px, 2px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.9);
}

/* =============================================
   MINI PREVIEW STYLES (for constructor gallery)
   These are scaled-down versions for the phone mockup
   ============================================= */
.mini-preview {
    height: 100%;
    font-size: 10px;
    overflow: hidden;
}

.mini-preview .mini-header {
    padding: 12px;
    text-align: center;
    color: white;
}

.mini-preview .mini-logo {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    margin: 0 auto 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-preview .mini-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mini-preview .mini-name {
    font-size: 11px;
    font-weight: 700;
}

.mini-preview .mini-desc {
    font-size: 7px;
    opacity: 0.8;
}

.mini-preview .mini-contact {
    display: flex;
    padding: 6px;
    background: #f8f9fa;
    font-size: 6px;
}

.mini-preview .mini-contact span {
    flex: 1;
    text-align: center;
    color: #666;
}

.mini-preview .mini-products {
    padding: 8px;
}

.mini-preview .mini-product {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 4px;
}

.mini-preview .mini-product-img {
    width: 28px;
    height: 28px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.mini-preview .mini-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-preview .mini-product-title {
    font-size: 8px;
    font-weight: 600;
}

.mini-preview .mini-product-price {
    font-size: 7px;
    font-weight: 600;
}

/* Mini Preview - Modern */
.mini-preview.template-modern {
    background: #1a1a2e;
    color: #f3f4f6;
}

.mini-preview.template-modern .mini-header {
    background: #1f2937;
    text-align: left;
}

.mini-preview.template-modern .mini-logo {
    margin: 0 0 6px 0;
    background: #374151;
}

.mini-preview.template-modern .mini-contact {
    background: #1f2937;
    border-bottom: 1px solid #374151;
}

.mini-preview.template-modern .mini-contact span {
    color: #9ca3af;
}

.mini-preview.template-modern .mini-product {
    background: #252541;
}

/* Mini Preview - Elegant */
.mini-preview.template-elegant {
    background: #fafafa;
}

.mini-preview.template-elegant .mini-header {
    background: white;
    color: #1a1a2e;
    border-bottom: 2px solid var(--primary);
}

.mini-preview.template-elegant .mini-logo {
    border-radius: 50%;
    border: 1px solid var(--primary);
}

.mini-preview.template-elegant .mini-name {
    font-style: italic;
}

.mini-preview.template-elegant .mini-contact {
    background: transparent;
    justify-content: center;
    gap: 8px;
}

.mini-preview.template-elegant .mini-contact span {
    flex: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 5px;
}

.mini-preview.template-elegant .mini-product {
    background: white;
    border: 1px solid #eee;
    border-radius: 2px;
}

/* Mini Preview - Fresh */
.mini-preview.template-fresh {
    background: #f0fdf4;
}

.mini-preview.template-fresh .mini-header {
    border-radius: 0 0 1rem 1rem;
}

.mini-preview.template-fresh .mini-contact {
    background: white;
    margin: -8px 6px 6px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mini-preview.template-fresh .mini-product {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Mini Preview - Energetic */
.mini-preview.template-energetic {
    background: white;
}

.mini-preview.template-energetic .mini-header {
    clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%);
    padding-bottom: 16px;
    text-transform: uppercase;
}

.mini-preview.template-energetic .mini-logo {
    border-radius: 0;
    transform: rotate(-3deg);
    border: 2px solid white;
}

.mini-preview.template-energetic .mini-name {
    font-weight: 800;
    font-style: italic;
}

.mini-preview.template-energetic .mini-product {
    border-radius: 0;
    border-left: 3px solid var(--primary);
}