:root {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --accent-color: #38bdf8;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --text-color: #e0e0e0;
    --border-radius: 4px;
}

/* Header - with maximum specificity and isolation */
body > .header,
body > #header-placeholder > .header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.25rem 0 !important;
    height: auto !important;
    width: 100%;
    margin: 0 !important;
}

body > .header .container,
body > #header-placeholder > .header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    height: auto !important;
    padding: 0 var(--spacing-unit) !important;
    margin: 0 auto !important;
    max-width: var(--container-width);
}

body > .header .logo,
body > #header-placeholder > .header .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.5;
}

body > .header .nav,
body > #header-placeholder > .header .nav {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
}

body > .header .nav-link,
body > #header-placeholder > .header .nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.5;
}

body > .header .nav-link:hover,
body > #header-placeholder > .header .nav-link:hover {
    color: var(--primary-color);
}

body > .header .nav-link.active,
body > #header-placeholder > .header .nav-link.active {
    color: var(--primary-color);
}

/* Mobile Menu */
body > .header .menu-button,
body > #header-placeholder > .header .menu-button {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin: 0;
    color: var(--text-color);
    /* Improved touch target size */
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    body > .header .menu-button,
    body > #header-placeholder > .header .menu-button {
        display: flex;
    }

    body > .header .nav,
    body > #header-placeholder > .header .nav {
        display: none;
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-header);
        flex-direction: column;
        padding: 1rem !important;
        border-bottom: 1px solid var(--border-color);
        gap: 1rem;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body > .header .nav.active,
    body > #header-placeholder > .header .nav.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    body > .header .nav-link,
    body > #header-placeholder > .header .nav-link {
        padding: 1rem !important;
        width: 100%;
        text-align: center;
        font-size: 1.1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.button:hover {
    background-color: #2563eb;
}

.button:active {
    background-color: #1d4ed8;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.2s;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Improve form elements on mobile */
@media (max-width: 768px) {
    select.form-input {
        background-position: right 0.75rem center;
        padding-right: 2.5rem;
    }

    textarea.form-input {
        min-height: 100px;
    }
}

/* Social Links */
.social-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.social-link {
    color: var(--secondary-color);
    transition: color 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

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

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--bg-secondary);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Utility Classes */
.mt-1 { margin-top: 1rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.ml-1 { margin-left: 1rem !important; }
.mr-1 { margin-right: 1rem !important; }

/* Mobile-specific utility classes */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}
