/* ==========================================
   Snow2Mow Global Styles
   ========================================== */

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

/* CSS Variables */
:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-900: #1e3a8a;
    
    --snow-50: #f8fafc;
    --snow-100: #f1f5f9;
    --snow-200: #e2e8f0;
    --snow-800: #1e293b;
    --snow-900: #0f172a;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Dark mode variables (default light) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
}

/* Dark mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;
    --border-color: #334155;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================
   Logo Styling
   ========================================== */

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-text .snow { color: #000000; }
.logo-text .two { color: var(--primary-900); }
.logo-text .mow { color: #000000; }

[data-theme="dark"] .logo-text .snow,
[data-theme="dark"] .logo-text .mow {
    color: #f8fafc;
}

/* ==========================================
   Navigation
   ========================================== */

#mainNav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] #mainNav {
    background: rgba(15, 23, 42, 0.95);
}

/* ==========================================
   Hero Section
   ========================================== */

.hero-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f172a 100%);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.image-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
}

/* ==========================================
   Feature Cards
   ========================================== */

.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Pricing Cards
   ========================================== */

.pricing-card {
    transition: all 0.3s ease;
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.pricing-card.popular {
    border: 2px solid var(--primary-600);
}

.popular-badge {
    position: absolute;
    top: -12px;
    right: 12px;
    background: var(--primary-900);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

/* ==========================================
   Modal Styles
   ========================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

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

@supports (backdrop-filter: blur(1px)) {
    .modal {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

.modal-content {
    background: var(--bg-primary);
    margin: auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlide 0.25s ease-out;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-large {
    max-width: 700px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    z-index: 10;
    background: none;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.close:hover {
    color: #1e293b;
    background: #f1f5f9;
}

/* ==========================================
   Form Styles
   ========================================== */

.form-group {
    margin-bottom: 1rem;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-900);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-group input.error {
    border-color: var(--error);
    background-color: rgba(239, 68, 68, 0.05);
}

.form-group input.valid {
    border-color: var(--success);
    background-color: rgba(16, 185, 129, 0.05);
}

/* Password Wrapper */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #374151;
    background: #f3f4f6;
}

/* Password Strength */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 0.5rem;
    transition: all 0.3s;
    width: 0;
}

.password-strength.weak {
    background: var(--error);
    width: 33%;
}

.password-strength.medium {
    background: var(--warning);
    width: 66%;
}

.password-strength.strong {
    background: var(--success);
    width: 100%;
}

.password-hint {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--text-secondary);
}

/* Error Messages */
.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
}

.field-error {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Checkbox Wrapper */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* ==========================================
   Toast Notifications - Modern Professional
   ========================================== */

#toastContainer, #toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    pointer-events: none;
}

.toast, .toast-notification {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9375rem;
    max-width: 380px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 10px 25px -5px rgba(0, 0, 0, 0.15);
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    border-left: 4px solid transparent;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.toast.show, .toast-notification.show {
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Success Toast - Green */
.toast.success, .toast-notification.success, .toast-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left-color: #10b981;
    color: #065f46;
}

.toast.success i, .toast-notification.success i, .toast-success i {
    color: #10b981;
    font-size: 1.25rem;
}

/* Error Toast - Red */
.toast.error, .toast-notification.error, .toast-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #ef4444;
    color: #991b1b;
}

.toast.error i, .toast-notification.error i, .toast-error i {
    color: #ef4444;
    font-size: 1.25rem;
}

/* Info Toast - Blue */
.toast.info, .toast-notification.info, .toast-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #3b82f6;
    color: #1e40af;
}

.toast.info i, .toast-notification.info i, .toast-info i {
    color: #3b82f6;
    font-size: 1.25rem;
}

/* Warning Toast - Amber */
.toast.warning, .toast-notification.warning, .toast-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left-color: #f59e0b;
    color: #92400e;
}

.toast.warning i, .toast-notification.warning i, .toast-warning i {
    color: #f59e0b;
    font-size: 1.25rem;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* ==========================================
   Loading Overlay
   ========================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1500;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary-900);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================
   Plan Selection
   ========================================== */

.plan-card {
    cursor: pointer;
    position: relative;
}

.plan-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.plan-content {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.plan-card input:checked + .plan-content {
    border-color: var(--primary-900);
    background: var(--primary-50);
}

.plan-card:hover .plan-content {
    border-color: var(--primary-900);
}

/* ==========================================
   Portal Buttons
   ========================================== */

.portal-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.portal-btn:hover {
    border-color: var(--primary-900);
    background: var(--primary-50);
}

/* ==========================================
   Sidebar Styles
   ========================================== */

.sidebar {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-item:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

.sidebar-item.active {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
}

/* ==========================================
   Card Styles
   ========================================== */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   Status Badges
   ========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-500);
}

/* ==========================================
   Progress Bar
   ========================================== */

.progress-bar {
    transition: width 0.5s ease;
}

/* ==========================================
   Animation Utilities
   ========================================== */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ==========================================
   Utility Classes
   ========================================== */

.hidden {
    display: none !important;
}

.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;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary-900);
    outline-offset: 2px;
}

/* ==========================================
   Responsive Design
   ========================================== */

@media (max-width: 640px) {
    .modal-content {
        margin: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .hero-gradient h1 {
        font-size: 2.5rem;
    }
    
    #toastContainer {
        left: 20px;
        right: 20px;
    }
    
    .toast {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .pricing-card.popular {
        transform: none;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
}

/* ==========================================
   Touch Device & Mobile Improvements
   ========================================== */

/* Disable hover transforms on touch devices (prevents click issues) */
@media (hover: none) {
    .portal-card:hover,
    .card-hover:hover,
    .feature-card:hover,
    .pricing-card:hover {
        transform: none !important;
        box-shadow: 0 1px 3px rgba(0,0,0,.12) !important;
    }
    .btn-gradient:hover {
        transform: none !important;
    }
}

/* Remove iOS/Android tap highlight flash */
a, button, [role="button"], label {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent double-tap zoom on buttons & links */
a, button, input, select, textarea {
    touch-action: manipulation;
}

/* Safe area insets (notches, home bars, etc.) */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Improve readability on small screens */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 12px 12px 0 0;
        max-height: 92vh;
    }
    #toastContainer, #toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
        max-width: calc(100vw - 24px);
    }
    .toast, .toast-notification {
        max-width: 100%;
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
}

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

/* Print Styles */
@media print {
    .modal,
    #toastContainer,
    .loading-overlay,
    nav,
    .snowflake {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ==========================================
   Scrollbar Styles
   ========================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--snow-200);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ==========================================
   Selection Styles
   ========================================== */

::selection {
    background: var(--primary-100);
    color: var(--primary-900);
}
