/* ===================================
   Multi-Site CMS - Vanilla CSS Framework
   =================================== */

/* CSS Custom Properties (Variables) */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #818cf8;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --white: #ffffff;
    --black: #000000;
    
    --font-family: 'Figtree', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --transition: all 0.15s ease-in-out;
}

/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    font-family: var(--font-family);
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--gray-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

p {
    margin: 0;
}

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

a:hover {
    text-decoration: underline;
}

/* Layout */
.min-h-screen {
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Flexbox Utilities */
.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.space-x-4 > * + * {
    margin-left: 1rem;
}

.space-x-8 > * + * {
    margin-left: 2rem;
}

.space-y-1 > * + * {
    margin-top: 0.25rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Display Utilities */
.block {
    display: block;
}

.hidden {
    display: none;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Width & Height */
.w-full {
    width: 100%;
}

.w-20 {
    width: 5rem;
}

.w-48 {
    width: 12rem;
}

.h-9 {
    height: 2.25rem;
}

.h-16 {
    height: 4rem;
}

.h-20 {
    height: 5rem;
}

.h-4 {
    height: 1rem;
}

.h-6 {
    height: 1.5rem;
}

.w-4 {
    width: 1rem;
}

.w-6 {
    width: 1.5rem;
}

.w-auto {
    width: auto;
}

/* Spacing */
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 1rem; }
.ms-1 { margin-inline-start: 0.25rem; }
.ms-2 { margin-inline-start: 0.5rem; }
.ms-3 { margin-inline-start: 0.75rem; }
.ms-6 { margin-inline-start: 1.5rem; }
.ms-10 { margin-inline-start: 2.5rem; }
.me-2 { margin-inline-end: 0.5rem; }

.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-3 { padding-bottom: 0.75rem; }

/* Background Colors */
.bg-white {
    background-color: var(--white);
}

.bg-gray-100 {
    background-color: var(--gray-100);
}

.bg-gray-800 {
    background-color: var(--gray-800);
}

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

.bg-primary:hover {
    background-color: var(--primary-hover);
}

/* Text Colors */
.text-white {
    color: var(--white);
}

.text-gray-500 {
    color: var(--gray-500);
}

.text-gray-600 {
    color: var(--gray-600);
}

.text-gray-700 {
    color: var(--gray-700);
}

.text-gray-800 {
    color: var(--gray-800);
}

.text-gray-900 {
    color: var(--gray-900);
}

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

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

/* Text Utilities */
.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-base {
    font-size: var(--font-size-base);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-widest {
    letter-spacing: 0.1em;
}

.leading-4 {
    line-height: 1rem;
}

.leading-5 {
    line-height: 1.25rem;
}

.underline {
    text-decoration: underline;
}

/* Borders */
.border {
    border: 1px solid var(--gray-300);
}

.border-b {
    border-bottom: 1px solid var(--gray-200);
}

.border-t {
    border-top: 1px solid var(--gray-200);
}

.border-b-2 {
    border-bottom: 2px solid transparent;
}

.border-transparent {
    border-color: transparent;
}

.border-gray-100 {
    border-color: var(--gray-100);
}

.border-gray-200 {
    border-color: var(--gray-200);
}

.border-gray-300 {
    border-color: var(--gray-300);
}

.border-primary {
    border-color: var(--primary-light);
}

.rounded {
    border-radius: var(--border-radius);
}

.rounded-md {
    border-radius: var(--border-radius);
}

.rounded-lg {
    border-radius: var(--border-radius-lg);
}

/* Shadows */
.shadow {
    box-shadow: var(--shadow);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

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

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* Focus & Ring */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary-color);
}

/* Transitions */
.transition {
    transition: var(--transition);
}

/* Overflow */
.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

.overflow-y-hidden {
    overflow-y: hidden;
}

/* Z-Index */
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Fill */
.fill-current {
    fill: currentColor;
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

/* ===================================
   Component Styles
   =================================== */

/* Navigation */
.nav {
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.nav-container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .nav-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .nav-container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    height: 4rem;
}

.nav-left {
    display: flex;
}

.nav-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.nav-logo a {
    display: block;
}

.nav-links {
    display: none;
    margin-left: 2.5rem;
}

@media (min-width: 640px) {
    .nav-links {
        display: flex;
        gap: 2rem;
    }
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.25rem;
    border-bottom: 2px solid transparent;
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 1.25rem;
    color: var(--gray-500);
    transition: var(--transition);
    text-decoration: none;
}

.nav-link:hover {
    color: var(--gray-700);
    border-bottom-color: var(--gray-300);
    text-decoration: none;
}

.nav-link.active {
    color: var(--gray-900);
    border-bottom-color: var(--primary-light);
}

.nav-link:focus {
    outline: none;
    color: var(--gray-700);
    border-bottom-color: var(--gray-300);
}

.nav-right {
    display: none;
}

@media (min-width: 640px) {
    .nav-right {
        display: flex;
        align-items: center;
        margin-left: 1.5rem;
    }
}

/* Mobile Menu Button */
.nav-mobile-btn-wrapper {
    display: flex;
    align-items: center;
    margin-inline-end: -0.5rem;
}

@media (min-width: 640px) {
    .nav-mobile-btn-wrapper {
        display: none;
    }
}

.nav-mobile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    color: var(--gray-400);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.nav-mobile-btn:hover {
    color: var(--gray-500);
    background-color: var(--gray-100);
}

.nav-mobile-btn:focus {
    outline: none;
    background-color: var(--gray-100);
    color: var(--gray-500);
}

.nav-mobile-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Mobile Navigation Menu */
.nav-mobile {
    display: none;
}

@media (min-width: 640px) {
    .nav-mobile {
        display: none !important;
    }
}

.nav-mobile.open {
    display: block;
}

.nav-mobile-links {
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
}

.responsive-nav-link {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    border-left: 4px solid transparent;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    transition: var(--transition);
}

.responsive-nav-link:hover {
    color: var(--gray-800);
    background-color: var(--gray-50);
    border-left-color: var(--gray-300);
    text-decoration: none;
}

.responsive-nav-link.active {
    color: var(--primary-color);
    background-color: #eef2ff;
    border-left-color: var(--primary-light);
}

.nav-mobile-settings {
    padding-top: 1rem;
    padding-bottom: 0.25rem;
    border-top: 1px solid var(--gray-200);
}

.nav-mobile-user {
    padding: 0 1rem;
}

.nav-mobile-user-name {
    font-weight: 500;
    font-size: var(--font-size-base);
    color: var(--gray-800);
}

.nav-mobile-user-email {
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

.nav-mobile-settings-links {
    margin-top: 0.75rem;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid transparent;
    font-size: var(--font-size-sm);
    line-height: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    color: var(--gray-500);
    background-color: var(--white);
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-trigger:hover {
    color: var(--gray-700);
}

.dropdown-trigger:focus {
    outline: none;
}

.dropdown-trigger svg {
    margin-left: 0.25rem;
    width: 1rem;
    height: 1rem;
    fill: currentColor;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    z-index: 50;
    margin-top: 0.5rem;
    width: 12rem;
    border-radius: var(--border-radius);
    background-color: var(--white);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.dropdown.open .dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dropdown-content {
    padding: 0.25rem 0;
}

.dropdown-link {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    line-height: 1.25rem;
    color: var(--gray-700);
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-link:hover {
    background-color: var(--gray-100);
    text-decoration: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary-color);
}

.btn-primary {
    background-color: var(--gray-800);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--gray-700);
}

.btn-primary:active {
    background-color: var(--gray-900);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background-color: var(--gray-50);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #dc2626;
}

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.section-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.section-desc {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin-bottom: 1.25rem;
}

.text-saved {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
}

.profile-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.auth-desc {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.auth-link {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.auth-link:hover {
    color: var(--gray-900);
}

.form-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-text {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
}

.form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-input:disabled {
    background-color: var(--gray-100);
    cursor: not-allowed;
}

.form-checkbox {
    width: 1rem;
    height: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    color: var(--primary-color);
    cursor: pointer;
}

.form-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-error {
    margin-top: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--danger-color);
}

.form-error ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}

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

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-body {
    padding: 1.5rem;
}

/* Page Header */
.page-header {
    background-color: var(--white);
    box-shadow: var(--shadow);
}

.page-header-inner {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
    .page-header-inner {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .page-header-inner {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Main Content */
.main-content {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
    .main-content {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .main-content {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Guest Layout (Auth Pages) */
.guest-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1.5rem;
    background-color: var(--gray-100);
}

@media (min-width: 640px) {
    .guest-layout {
        justify-content: center;
        padding-top: 0;
    }
}

.guest-logo {
    margin-bottom: 1.5rem;
}

.guest-logo a {
    display: block;
}

.guest-logo svg {
    width: 5rem;
    height: 5rem;
    fill: var(--gray-500);
}

.guest-card {
    width: 100%;
    max-width: 28rem;
    padding: 1rem 1.5rem;
    background-color: var(--white);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

@media (min-width: 640px) {
    .guest-card {
        border-radius: var(--border-radius-lg);
    }
}

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

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Session Status */
.session-status {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #065f46;
    background-color: #d1fae5;
    border-radius: var(--border-radius);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-backdrop.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 32rem;
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-body {
    padding: 1.5rem;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-600);
    background-color: var(--gray-100);
}

/* Application Logo */
.app-logo {
    width: auto;
    height: 2.25rem;
    fill: currentColor;
    color: var(--gray-800);
}

.app-logo-lg {
    width: 5rem;
    height: 5rem;
}

/* Responsive utilities */
@media (min-width: 640px) {
    .sm-hidden { display: none; }
    .sm-block { display: block; }
    .sm-flex { display: flex; }
    .sm-inline-flex { display: inline-flex; }
    .sm-max-w-md { max-width: 28rem; }
    .sm-rounded-lg { border-radius: var(--border-radius-lg); }
    .sm-px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (min-width: 1024px) {
    .lg-px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Utility: sr-only (screen reader only) */
.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;
}
