/**
 * Main Styles
 * CCL Properties Analysis - Multi-User Beta Platform
 * Brand: Community CoLiving - Teal #487A7B, Orange #F68D2E
 */

/* ===== CSS Variables ===== */
:root {
    /* Brand Colors */
    --color-teal: #487A7B;
    --color-teal-dark: #005151;
    --color-teal-light: #6B9A9A;
    --color-orange: #F68D2E;
    --color-orange-light: #FF9A5A;

    /* Status Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #487A7B;

    /* Grays */
    --color-gray-50: #FAFAFA;
    --color-gray-100: #F4F4F5;
    --color-gray-200: #E4E4E7;
    --color-gray-300: #D4D4D8;
    --color-gray-400: #A1A1AA;
    --color-gray-500: #6B7280;
    --color-gray-600: #52525B;
    --color-gray-700: #3F3F46;
    --color-gray-800: #27272A;
    --color-gray-900: #111827;

    /* Gradients */
    --gradient-teal: linear-gradient(135deg, #487A7B 0%, #005151 100%);
    --gradient-orange: linear-gradient(135deg, #F68D2E 0%, #FF9A5A 100%);
    --gradient-subtle: linear-gradient(180deg, rgba(72,122,123,0.03) 0%, rgba(0,81,81,0.08) 100%);

    /* Shadows - REFINED: More subtle for modern look */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-teal: 0 2px 12px rgba(72, 122, 123, 0.15);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);

    /* Spacing - REFINED: Increased for more breathing room */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.75rem;
    --spacing-xl: 2.5rem;
    --spacing-2xl: 4rem;

    /* Border Radius - REFINED: Larger for modern look */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-2xl: 1.75rem;
    --radius-full: 9999px;

    /* Transitions - NEW */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Font Families */
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--gradient-subtle);
    color: var(--color-gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.3;
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--spacing-xl) 0;
}

/* ===== Header - REFINED ===== */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-gray-100);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-teal-dark);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-teal);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

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

.user-name {
    font-weight: 500;
    color: var(--color-gray-600);
}

/* ===== Cards - REFINED ===== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-gray-200);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.card-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ===== Buttons - REFINED ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-teal);
    color: white;
    box-shadow: var(--shadow-teal);
}

.btn-primary:hover {
    background: var(--color-teal-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(72, 122, 123, 0.25);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--color-teal);
    border: 2px solid var(--color-teal);
}

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

.btn-ghost {
    background: transparent;
    color: var(--color-gray-600);
}

.btn-ghost:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-800);
}

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

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1rem;
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.75rem;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

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

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px rgba(72, 122, 123, 0.15);
}

.form-input::placeholder {
    color: var(--color-gray-400);
}

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

.form-error {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
}

/* ===== Slots Grid ===== */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.slot-card {
    position: relative;
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    transition: all var(--transition-slow);
    min-height: 180px;
}

.slot-locked {
    background: var(--color-gray-50);
    border: 1.5px dashed var(--color-gray-300);
    opacity: 0.7;
}

.slot-ready {
    background: white;
    border: 1.5px solid var(--color-teal);
    box-shadow: var(--shadow-md);
}

.slot-ready:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-teal-dark);
}

.slot-generating {
    background: white;
    border: 1.5px solid var(--color-orange);
    animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
    0%, 100% {
        border-color: var(--color-orange);
        box-shadow: 0 0 0 0 rgba(246, 141, 46, 0.1);
    }
    50% {
        border-color: var(--color-orange-light);
        box-shadow: 0 0 0 4px rgba(246, 141, 46, 0.1);
    }
}

.slot-completed {
    background: white;
    border: 1.5px solid var(--color-success);
}

.slot-error {
    background: white;
    border: 1.5px solid var(--color-error);
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.slot-number {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-gray-800);
}

.slot-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.slot-address {
    font-size: 0.875rem;
    color: var(--color-gray-600);
    margin-bottom: var(--spacing-md);
    min-height: 2.5rem;
}

/* ===== Progress Bar - REFINED ===== */
.progress-container {
    margin-bottom: var(--spacing-md);
}

.progress-bar {
    height: 6px;
    background: var(--color-gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-orange);
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-gray-400);
    margin-top: var(--spacing-sm);
    font-weight: 500;
}

/* ===== Investment Grades ===== */
.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    color: white;
}

.grade-a { background: linear-gradient(135deg, #10B981, #059669); }
.grade-b { background: linear-gradient(135deg, #487A7B, #005151); }
.grade-c { background: linear-gradient(135deg, #F59E0B, #D97706); }
.grade-d { background: linear-gradient(135deg, #F97316, #EA580C); }
.grade-f { background: linear-gradient(135deg, #EF4444, #DC2626); }
.grade-unknown { background: var(--color-gray-400); }

/* ===== Hero Section ===== */
.hero {
    background: var(--gradient-teal);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-2xl);
    color: white;
    margin-bottom: var(--spacing-xl);
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.metric-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    text-align: center;
}

.metric-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.5rem;
}

.metric-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-top: var(--spacing-xs);
}

/* ===== Toast Notifications ===== */
#toast-container {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-error); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info { border-left: 4px solid var(--color-info); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-2xl);
    padding: var(--spacing-2xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    padding: var(--spacing-xs);
}

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

/* ===== Loading Spinner ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-subtle);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: var(--spacing-2xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.login-header h1 {
    font-size: 1.75rem;
    color: var(--color-gray-900);
    margin-bottom: var(--spacing-sm);
}

.login-header p {
    color: var(--color-gray-500);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--color-gray-500);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-lg);
    color: var(--color-gray-300);
}

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

/* Tablet breakpoint */
@media (max-width: 1024px) {
    .hero-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    /* Header Mobile */
    .header {
        padding: var(--spacing-sm) 0;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        gap: var(--spacing-sm);
    }

    .logo {
        font-size: 1rem;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
    }

    .user-menu {
        gap: var(--spacing-sm);
    }

    .user-name {
        display: none;
    }

    /* Hero Mobile */
    .hero {
        padding: var(--spacing-lg);
        border-radius: var(--radius-xl);
    }

    .hero-metrics {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .metric-card {
        padding: var(--spacing-md);
    }

    .metric-value {
        font-size: 1.75rem;
    }

    .metric-label {
        font-size: 0.75rem;
    }

    /* Cards Mobile */
    .card {
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
    }

    /* Slots Grid Mobile */
    .slots-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .slot-card {
        padding: var(--spacing-lg);
        min-height: 160px;
    }

    .slot-number {
        font-size: 1.125rem;
    }

    .slot-address {
        font-size: 0.8125rem;
    }

    /* Buttons Mobile */
    .btn {
        padding: 0.5rem var(--spacing-md);
        font-size: 0.8125rem;
    }

    .btn-lg {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 0.875rem;
    }

    /* Forms Mobile */
    .form-input {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 1rem;
    }

    /* Modal Mobile */
    .modal {
        padding: var(--spacing-lg);
        border-radius: var(--radius-xl);
        width: 95%;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    /* Toast Mobile */
    #toast-container {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        left: var(--spacing-md);
    }

    .toast {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Login Mobile */
    .login-card {
        padding: var(--spacing-lg);
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    /* Empty State */
    .empty-state {
        padding: var(--spacing-lg);
    }

    .empty-state-icon {
        width: 48px;
        height: 48px;
    }

    /* Grade Badge Mobile */
    .grade-badge {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

/* Small mobile breakpoint */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .hero {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .slot-card {
        padding: var(--spacing-md);
        min-height: 140px;
    }

    .modal {
        padding: var(--spacing-md);
        width: 98%;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Ensure minimum 44px touch targets */
    .btn,
    .slot-card,
    .form-input {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .card:hover,
    .slot-ready:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
}

/* ===== Lucide Icon Sizing ===== */
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
