/* ========================================
   SKINROUTINE - UNIFIED THEME
   Elegant, warm, and cohesive design
   ======================================== */

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

/* CSS Variables - Consistent Theme */
:root {
    /* Color Palette */
    --primary: #B89778;
    --primary-dark: #8B6F52;
    --primary-gradient: linear-gradient(135deg, #D4A574 0%, #B89778 100%);
    --text-primary: #2C2421;
    --text-secondary: #6B635F;
    --text-muted: #9B8F89;
    --text-light: #5C5552;
    --border: rgba(180, 151, 120, 0.2);
    --border-focus: #B89778;
    --error: #D97706;
    --success: #059669;
    --background: #FFF8F3;
    --background-alt: #F5EDE5;
    --background-gradient: linear-gradient(165deg, #FFF8F3 0%, #F5EDE5 50%, #FFF5EE 100%);
    --white: #FFFFFF;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(180, 151, 120, 0.08);
    --shadow-md: 0 4px 16px rgba(180, 151, 120, 0.12);
    --shadow-lg: 0 8px 25px rgba(180, 151, 120, 0.15);
    --shadow-xl: 0 15px 40px rgba(180, 151, 120, 0.2);

    /* Border Radius */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 20px;

    /* Transitions */
    --transition: all 0.3s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-gradient);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: 48px;
    letter-spacing: -1px;
}

h2 {
    font-size: 40px;
    letter-spacing: -0.8px;
}

h3 {
    font-size: 32px;
    letter-spacing: -0.6px;
}

h4 {
    font-size: 24px;
    letter-spacing: -0.4px;
}

p {
    font-family: 'Inter', sans-serif;
    line-height: 1.65;
    color: var(--text-secondary);
    letter-spacing: -0.1px;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: var(--transition);
}

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

/* Container */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Header */
.header {
    background-color: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.header-logo a {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 26px;
    font-weight: 600;
    background: linear-gradient(135deg, #B89778 0%, #8B6F52 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.3px;
    transition: var(--transition);
}

.header-logo a:hover {
    transform: translateY(-2px);
}

.header-nav {
    display: flex;
    gap: 40px;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.1px;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-dark);
}

.nav-link:hover::after {
    width: 100%;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.account-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.1px;
    padding: 10px 24px;
    border-radius: 25px;
    transition: var(--transition);
}

.account-link:hover {
    background: var(--background);
}

.account-link.signup {
    background: var(--primary-gradient);
    color: white;
}

.account-link.signup:hover {
    background: linear-gradient(135deg, #C9A88F 0%, #A88565 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn, .btn-primary, .btn-secondary, .btn-outline {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #C9A88F 0%, #A88565 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--primary-dark);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-dark);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    background: var(--background);
    border-color: var(--primary);
}

/* Cards */
.card, .product-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover, .product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Product Card Specific */
.product-name {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.product-reason {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
}

/* Sections */
.section {
    padding: 120px 0;
    position: relative;
}

.section-white {
    background: white;
}

.section-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 48px;
    font-weight: 600;
    text-align: center;
    background: linear-gradient(135deg, #5C5552 0%, #8B6F52 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -1px;
    line-height: 1.2;
}

.section-subtitle {
    text-align: center;
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 70px;
    font-weight: 400;
    letter-spacing: -0.1px;
    line-height: 1.6;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.1px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.1px;
}

.form-input:hover, .form-select:hover, .form-textarea:hover {
    border-color: rgba(184, 151, 120, 0.4);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(184, 151, 120, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Checkbox & Radio */
.form-checkbox, .form-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-checkbox label,
.form-radio label {
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    letter-spacing: -0.1px;
}

/* Grids */
.grid {
    display: grid;
    gap: 32px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Routine Grid */
.routine-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin-top: 48px;
}

.routine-column {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.routine-label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 32px;
    font-weight: 600;
    background: linear-gradient(135deg, #D4A574 0%, #8B6F52 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
    letter-spacing: -0.1px;
}

.alert-error {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #93C5FD;
}

/* Footer */
.footer {
    background: white;
    padding: 70px 40px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-logo {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 26px;
    font-weight: 600;
    background: linear-gradient(135deg, #B89778 0%, #8B6F52 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.footer-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: -0.1px;
}

/* Responsive Design */

/* Tablet (1024px and below) */
@media (max-width: 1024px) {
    .container {
        padding: 0 24px;
    }

    .header-container {
        padding: 0 24px;
    }

    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .routine-grid {
        gap: 24px;
    }

    /* Better touch targets */
    .btn, .btn-primary, .btn-secondary, .btn-outline {
        min-height: 48px;
        padding: 14px 32px;
    }

    .account-link {
        min-height: 44px;
        padding: 12px 24px;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    /* Typography - Better readability on mobile */
    h1 {
        font-size: 36px;
        letter-spacing: -0.8px;
    }

    h2 {
        font-size: 32px;
        letter-spacing: -0.6px;
    }

    h3 {
        font-size: 24px;
        letter-spacing: -0.4px;
    }

    h4 {
        font-size: 20px;
    }

    p {
        font-size: 15px;
        line-height: 1.7;
    }

    /* Section spacing for mobile */
    .section {
        padding: 60px 0;
    }

    .section-title {
        font-size: 32px;
        margin-bottom: 16px;
    }

    .section-subtitle {
        font-size: 16px;
        margin-bottom: 40px;
    }

    /* Hide desktop navigation */
    .header-nav {
        display: none;
    }

    /* Header adjustments */
    .header-container {
        height: 70px;
    }

    .header-logo a {
        font-size: 22px;
    }

    /* Single column layouts on mobile */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .routine-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .routine-column {
        padding: 24px;
    }

    .routine-label {
        font-size: 28px;
        margin-bottom: 24px;
    }

    /* Cards - Better spacing on mobile */
    .card, .product-card {
        padding: 20px;
        border-radius: 14px;
    }

    /* Form elements - Larger touch targets */
    .form-input, .form-select, .form-textarea {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 10px;
    }

    .form-label {
        font-size: 15px;
        margin-bottom: 10px;
    }

    /* Button improvements for mobile */
    .btn, .btn-primary, .btn-secondary, .btn-outline {
        min-height: 48px;
        padding: 14px 28px;
        font-size: 15px;
        border-radius: 24px;
        width: 100%; /* Full width on mobile */
        max-width: 400px;
        margin: 0 auto;
        display: block;
    }

    .header-actions .account-link {
        width: auto; /* Keep header buttons inline */
    }

    /* Profile dropdown - Mobile optimization */
    .profile-trigger {
        padding: 8px 14px;
        font-size: 13px;
    }

    .profile-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .profile-dropdown-menu {
        min-width: 200px;
        right: -10px;
    }

    /* Footer adjustments */
    .footer {
        padding: 50px 24px;
    }

    .footer-logo {
        font-size: 22px;
    }

    .footer-text {
        font-size: 13px;
    }
}

/* Small Mobile (640px and below) */
@media (max-width: 640px) {
    /* Extra tight spacing for small screens */
    .container {
        padding: 0 16px;
    }

    .header-container {
        padding: 0 16px;
        height: 65px;
    }

    /* Typography - Even more compact */
    h1 {
        font-size: 30px;
        line-height: 1.15;
    }

    h2 {
        font-size: 26px;
    }

    h3 {
        font-size: 20px;
    }

    /* Section spacing - Very tight */
    .section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 26px;
    }

    .section-subtitle {
        font-size: 15px;
    }

    /* Buttons - Slightly smaller but still tappable */
    .btn, .btn-primary, .btn-secondary, .btn-outline {
        padding: 13px 24px;
        font-size: 14px;
        min-height: 46px;
    }

    /* Header actions - Compact */
    .header-actions {
        gap: 10px;
    }

    .account-link {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* Cards - Compact padding */
    .card, .product-card {
        padding: 16px;
    }

    .routine-column {
        padding: 20px;
    }

    /* Product details */
    .product-name {
        font-size: 16px;
    }

    .product-reason {
        font-size: 13px;
    }

    .product-price {
        font-size: 18px;
    }

    /* Grid spacing */
    .grid {
        gap: 16px;
    }

    .routine-grid {
        gap: 16px;
    }

    /* Profile dropdown - Very compact */
    .profile-trigger {
        padding: 6px 10px;
        font-size: 12px;
    }

    .profile-trigger span:last-child {
        display: none; /* Hide dropdown arrow on very small screens */
    }

    .profile-avatar {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .dropdown-header {
        padding: 12px;
    }

    .dropdown-user-name {
        font-size: 14px;
    }

    .dropdown-user-email {
        font-size: 12px;
    }

    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Extra Small Mobile (480px and below) */
@media (max-width: 480px) {
    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 22px;
    }

    .header-logo a {
        font-size: 20px;
    }

    .section {
        padding: 32px 0;
    }

    .routine-label {
        font-size: 24px;
    }

    /* Hide user name in header on very small screens */
    .profile-trigger span:not(.profile-avatar):not(:last-child) {
        display: none;
    }

    /* Keep both login and signup buttons visible on mobile */
    .header-actions .account-link {
        padding: 6px 14px;
        font-size: 12px;
    }
}

/* Landscape orientation improvements */
@media (max-width: 768px) and (orientation: landscape) {
    .section {
        padding: 40px 0;
    }

    .header-container {
        height: 60px;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 28px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets for touch devices */
    .nav-link, .account-link, .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .card:hover, .product-card:hover {
        transform: none;
    }

    .btn-primary:hover, .btn-secondary:hover {
        transform: none;
    }

    /* Active states for better feedback */
    .btn:active, .btn-primary:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .card:active, .product-card:active {
        transform: scale(0.99);
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 48px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 48px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
