/**
 * Novish Studio Sales CRM
 * Core Brand Design System (app.css)
 */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Inter:wght@300;400;500;600;700&display=swap');

/* Brand Design Tokens */
:root {
    /* Color Palette */
    --bg: #F7F2EB;           /* Warm Cream (Primary Background) */
    --bg-alt: #EFE8DF;       /* Alabaster Cream (Secondary/Alternative Background) */
    --accent: #6E0D0D;       /* Novish Maroon (Primary Accent / Brand Color) */
    --accent-hover: #8C1515; /* Bright Maroon (Hover & Active states) */
    --text-primary: #1A1A1A; /* Off-Black Charcoal (Body and Headings Text) */
    --text-secondary: #5B5B5B; /* Medium Grey (Subtext and Muted Elements) */
    --text-muted: #8E8E8E;   /* Muted Grey */
    --border-color: #E6DDD3; /* Warm Beige Border (Dividers, outlines) */
    --card-bg: #FFFFFF;      /* White (Card backgrounds) */
    --cream: #F7F2EB;        /* Helper Cream */

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-italic: 'Cormorant Garamond', serif;
    --font-body: 'Inter', sans-serif;

    /* Glassmorphism helpers for Light Theme */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-blur: blur(8px);
    --glass-border: rgba(230, 221, 211, 0.5);

    /* Transitions & Shadows */
    --transition-smooth: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    --shadow-soft: 0 10px 30px rgba(110, 13, 13, 0.04);
    --shadow-hover: 0 20px 40px rgba(110, 13, 13, 0.08); /* Maroon shadow bloom */

    /* Standard Status Colors */
    --status-success: #1e4620;
    --status-success-bg: #edf7ed;
    --status-warning: #663c00;
    --status-warning-bg: #fff8e1;
    --status-error: #5f2120;
    --status-error-bg: #fdeded;
    --status-info: #0d3c61;
    --status-info-bg: #e5f6fd;
}

/* Dark Mode Override (Inverted Brand Palette) */
body.dark-mode {
    --bg: #1A1A1A;           /* Charcoal Background */
    --bg-alt: #121212;       /* Deeper Background */
    --accent: #EFE8DF;       /* Warm Cream Accent */
    --accent-hover: #FFFFFF; /* Pure White Hover */
    --text-primary: #F7F2EB; /* Warm Cream Text */
    --text-secondary: #A5A5A5; /* Muted Light Grey */
    --text-muted: #7E7E7E;
    --border-color: rgba(247, 242, 235, 0.12); /* Subtle Cream Border */
    --card-bg: #222222;      /* Off-black Cards */

    --glass-bg: rgba(34, 34, 34, 0.85);
    --glass-border: rgba(247, 242, 235, 0.08);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.6);

    /* Status inverted for Dark Theme readability */
    --status-success: #81c784;
    --status-success-bg: rgba(129, 199, 132, 0.1);
    --status-warning: #ffb74d;
    --status-warning-bg: rgba(255, 183, 77, 0.1);
    --status-error: #e57373;
    --status-error-bg: rgba(229, 115, 115, 0.1);
    --status-info: #64b5f6;
    --status-info-bg: rgba(100, 181, 246, 0.1);
}

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

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Layout Wrapper */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px; /* Sidebar Width */
    min-width: 0;
    transition: var(--transition-smooth);
}

.page-body {
    flex: 1;
    padding: 2.5rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* Typography Scale & Helpers */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 { font-size: clamp(32px, 4vw, 44px); }
h2 { font-size: clamp(24px, 3vw, 32px); }
h3 { font-size: clamp(20px, 2.5vw, 24px); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--accent-hover);
}

em.serif-em {
    font-family: var(--font-italic);
    color: var(--accent);
    font-style: italic;
    font-weight: 400;
}

.eyebrow {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    display: block;
    margin-bottom: 0.5rem;
}

p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Editorial Brand Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px) scale(1.005);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

/* Reusable Table Styling */
.table-responsive, .table-container {
    overflow-x: auto;
    width: 100%;
    margin-top: 1rem;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}

tr:hover td {
    background-color: var(--bg-alt);
}

/* Brand Buttons (Pill-shaped, scale animation) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: scale(1.03);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--text-primary);
    color: var(--bg);
    transform: scale(1.03);
}

/* Minimalist Form Controls (Bottom Border Only) */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.form-label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    border-radius: 0;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

textarea.form-control {
    min-height: 80px;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
}

textarea.form-control:focus {
    border-color: var(--accent);
}

/* Badges for CRM states */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background: var(--status-success-bg); color: var(--status-success); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-danger { background: var(--status-error-bg); color: var(--status-error); }
.badge-info { background: var(--status-info-bg); color: var(--status-info); }

/* Shimmer/Skeleton Loading state */
.shimmer {
    background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border-color) 50%, var(--bg-alt) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Desktop First / Mobile Responsive Adaptations */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0; /* Sidebar collapses to drawer */
    }
    .page-body {
        padding: 1.5rem;
    }
}

/* Specific Phone/Tablet Portrait Layout Optimizations */
@media (max-width: 768px) {
    .page-body {
        padding: 1rem;
    }
    
    .card {
        padding: 1.25rem !important; /* Make cards less padded on mobile screen */
        border-radius: 8px;
    }

    h1, .h1 {
        font-size: 1.5rem !important;
    }

    h2, .h2 {
        font-size: 1.25rem !important;
    }

    /* Stack any two-column forms or layout grids globally on small viewports */
    .grid-2, .grid-col-2, .form-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Make tables container have horizontal overflow scroll indicator */
    .table-container {
        border-radius: 8px;
        margin-top: 0.5rem;
    }

    /* Title row stacks vertically with full-width action button on mobile */
    .admin-title-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .admin-title-row button {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 0.65rem 1rem !important;
    }
}
