/* PetForLove - Global foundation and shared components */

/* 01. Reset & tokens */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --primary-color: #ff6c92;
    --primary-dark: #e5597a;
    --primary-light: #ffb3d1;
    --secondary-color: #5276ee;
    --accent-color: #FFD93D;
    --text-dark: #2D3748;
    --text-light: #718096;
    --text-muted: #A0AEC0;
    --bg-light: #ffebee;
    --bg-white: #FFFFFF;
    --border-color: #ffcdd2;
    --success-color: #48BB78;
    --error-color: #F56565;

    /* Typography */
    --font-primary: 'Poppins', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
    --nav-height: 77.5px;
    --nav-offset: var(--nav-height);
}

body {
    font-family: var(--font-primary);
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--bg-white);
    overflow-x: hidden;
}

main {
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* 02. Shared components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

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

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

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #4058d9);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-full {
    width: 100%;
    position: relative;
}

.btn-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.spinner {
    width: 20px;
    height: 20px;
    animation: rotate 2s linear infinite;
}

.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

.alert {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    font-size: 0.95rem;
}

.alert-success,
.alert.success {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.alert-error,
.alert.error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.alert.warning {
    background: #fff8e1;
    color: #f57c00;
    border: 1px solid #ffb74d;
}

.surface,
.page-header-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    background: #ffe8f0;
    color: #be2f64;
    font-size: 0.75rem;
    font-weight: 600;
}

.kpi-row {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    background: #fff;
}

.kpi strong {
    display: block;
    font-size: 1.6rem;
    line-height: 1.1;
    color: var(--text-dark);
}

.kpi span {
    color: var(--text-light);
    font-size: 0.85rem;
}

.muted {
    color: var(--text-light);
    font-size: 0.9rem;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
    color: var(--text-dark);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-label svg {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text-dark);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 108, 146, 0.1);
}

.form-input.error,
.form-group.has-error .form-input {
    border-color: var(--error-color);
}

.form-error {
    display: block;
    min-height: 20px;
    margin-top: var(--spacing-xs);
    color: var(--error-color);
    font-size: 0.875rem;
}

.form-help {
    margin-top: var(--spacing-xs);
    color: var(--text-light);
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-light);
    font-size: 0.875rem;
    cursor: pointer;
}

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

/* 03. Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: all var(--transition-base);
}

/* Layout contract for pages with a fixed navbar. */
body.app-with-nav {
    padding-top: var(--nav-offset);
}

body.app-with-nav .navbar {
    position: fixed;
    top: 0;
}

body.app-with-nav > main,
body.app-with-nav > section:first-of-type {
    margin-top: 0;
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

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

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-dark);
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

/* 06. Motion */
@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* 07. Responsive */
@media (max-width: 768px) {
    :root {
        --nav-height: 73.5px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}

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

    .btn {
        width: 100%;
    }
}
