/* CSS Variables */
:root {
    --color-primary: #059669;
    --color-primary-hover: #047857;
    --color-background: #FFFFFF;
    --color-surface: #F8F9FA;
    --color-text-primary: #374151;
    --color-text-secondary: #4A4A4A;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', system-ui, sans-serif;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --color-primary: #10B981;
    --color-primary-hover: #059669;
    --color-background: #0F0F0F;
    --color-surface: #1A1A1A;
    --color-text-primary: #D1D5DB;
    --color-text-secondary: #D1D5DB;
    --color-text-muted: #9CA3AF;
    --color-border: #374151;
}

/* Alpine.js cloak utility */
[x-cloak] { 
    display: none !important; 
}

/* CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-family: var(--font-family);
    font-display: swap;
    color: var(--color-text-primary);
    background-color: var(--color-background);
    transition: all 0.3s ease;
    line-height: 1.6;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

/* Layout */
.container {
    max-width: 75em;
    margin: 0 auto;
    padding: 0 1em;
}

/* Typography */
h1 {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 1rem;
}

p {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    font-size: 1.125rem;
    line-height: 1.6;
}

/* Navigation */
.nav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 4em;
    background-color: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(1em);
    z-index: 100 !important;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding-top: 0.5em;
}

.nav-brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1.25em;
    color: var(--color-text-primary);
    text-decoration: none;
}

.nav-brand:hover {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.logo {
    height: 1.8em;
    width: auto;
}

.logo .cls-1 {
    fill: var(--color-primary);
}

.logo .cls-2 {
    fill: var(--color-text-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.nav-cta-button {
    background-color: var(--color-primary);
    color: white;
    padding: 0.5em 1em;
    border-radius: 0.375em;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875em;
    transition: all 0.2s ease;
    height: 2.25em;
    display: flex;
    align-items: center;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.nav-cta-button:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-0.0625em);
}

.theme-toggle {
    background: none;
    border: none;
    border-radius: 0.5em;
    padding: 0.5em;
    cursor: pointer;
    width: 2.5em;
    height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon {
    width: 1.25em;
    height: 1.25em;
    fill: var(--color-text-secondary);
    transition: fill 0.2s ease;
}

.theme-toggle:hover .theme-icon {
    fill: var(--color-primary);
}

/* Main content */
main {
    margin-top: 4em;
    min-height: calc(100vh - 4em);
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 0.75rem 0;
    text-align: center;
    z-index: 10;
}

/* Landing page specific */
.landing-gradient-text {
    background: linear-gradient(to right, #059669, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

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

.btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.btn-small.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.btn-small.btn-secondary:hover {
    background: var(--color-border);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    background: var(--color-background);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.form-input-container {
    position: relative;
}

.form-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 1px #dc2626;
    padding-right: 2.5rem;
}

.form-input.validating {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px #f59e0b;
    padding-right: 2.5rem;
}

.form-input-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 1rem;
}

.form-input-icon.error {
    color: #dc2626;
}

.form-input-icon.success {
    color: #10b981;
}

.form-input-icon.validating {
    color: #f59e0b;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    background: var(--color-background);
    min-height: 4rem;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

/* Modal */
.modal {
    background: var(--color-background);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 48rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: 0 1.5rem;
    transform: scale(1);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 2em 1.5rem 1.5rem;
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-background);
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Dark theme form adjustments */
[data-theme="dark"] .modal {
    background: #2A2A2A;
}

[data-theme="dark"] .form-input {
    color: var(--color-text-primary);
    background: var(--color-background);
}

[data-theme="dark"] .form-textarea {
    color: var(--color-text-primary);
    background: var(--color-background);
}

/* Privacy text */
.privacy-text {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-cta-button {
        font-size: 0.8em;
        padding: 0.4em 0.8em;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem;
    }
    
    .modal {
        max-width: 100%;
    }
}