/* ===================================
   Haiti Report Assistant - Styles
   Earthy, warm, glassmorphic design
   =================================== */

:root {
    /* Haiti-inspired earth tones */
    --color-earth-deep: #2D2418;
    --color-earth-brown: #5C4033;
    --color-earth-warm: #8B6914;
    --color-sand: #D4A574;
    --color-sand-light: #E8D4B8;
    --color-cream: #FDF6E3;
    --color-white: #FFFEF9;
    
    /* Accent colors */
    --color-ocean: #1E6F7C;
    --color-ocean-light: #2A8F9F;
    --color-success: #4A7C59;
    --color-warning: #B8860B;
    --color-error: #A63D40;
    
    /* Glass effects */
    --glass-bg: rgba(253, 246, 227, 0.7);
    --glass-border: rgba(93, 64, 51, 0.15);
    --glass-shadow: 0 8px 32px rgba(45, 36, 24, 0.15);
    
    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

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

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

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--color-sand-light) 0%, var(--color-cream) 50%, var(--color-sand-light) 100%);
    color: var(--color-earth-deep);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

.english {
    display: block;
    font-size: 0.85em;
    color: var(--color-earth-brown);
    opacity: 0.7;
    font-style: italic;
    margin-top: var(--space-xs);
}

/* Glass Card Effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

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

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-ocean) 0%, var(--color-ocean-light) 100%);
    color: var(--color-white);
    box-shadow: 0 4px 15px rgba(30, 111, 124, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 111, 124, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    color: var(--color-earth-brown);
    padding: var(--space-sm) var(--space-md);
}

.btn-ghost:hover {
    background: rgba(92, 64, 51, 0.1);
}

.btn-small {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

.btn-large {
    padding: var(--space-lg) var(--space-xl);
    font-size: 1.1rem;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--color-earth-brown);
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-earth-deep);
    background: var(--color-white);
    border: 2px solid var(--color-sand);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-ocean);
    box-shadow: 0 0 0 4px rgba(30, 111, 124, 0.15);
}

textarea {
    resize: vertical;
    min-height: 150px;
}

::placeholder {
    color: var(--color-sand);
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* ===================================
   LOGIN SCREEN
   =================================== */
#login-screen {
    display: none;
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
}

#login-screen.active {
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 440px;
    z-index: 10;
}

.login-card {
    padding: var(--space-2xl);
    text-align: center;
}

.logo-section {
    margin-bottom: var(--space-xl);
}

.logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    color: var(--color-ocean);
}

.logo-section h1 {
    color: var(--color-earth-deep);
    margin-bottom: var(--space-sm);
}

.subtitle {
    color: var(--color-earth-brown);
    font-size: 1rem;
}

.login-form {
    margin: var(--space-xl) 0;
}

.login-form .form-group {
    text-align: left;
}

.login-form .btn {
    width: 100%;
}

.login-help {
    font-size: 0.875rem;
    color: var(--color-earth-brown);
    line-height: 1.5;
}

/* Background Decorations */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
}

.bg-circle-1 {
    width: 600px;
    height: 600px;
    background: var(--color-ocean);
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 400px;
    height: 400px;
    background: var(--color-earth-warm);
    bottom: -100px;
    left: -100px;
    animation: float 25s ease-in-out infinite reverse;
}

.bg-circle-3 {
    width: 300px;
    height: 300px;
    background: var(--color-sand);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, 30px); }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.15; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.1; }
}

/* ===================================
   APP SCREEN
   =================================== */
#app-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
}

#app-screen.active {
    display: flex;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-small {
    width: 36px;
    height: 36px;
    color: var(--color-ocean);
}

.app-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-earth-deep);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-info {
    font-size: 0.875rem;
    color: var(--color-earth-brown);
}

#logout-btn svg {
    width: 18px;
    height: 18px;
}

/* Main Layout */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    font-size: 1rem;
    color: var(--color-earth-brown);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.history-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-earth-brown);
    opacity: 0.7;
}

.history-item {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.history-item:hover {
    background: rgba(30, 111, 124, 0.08);
    border-color: var(--glass-border);
}

.history-item.active {
    background: rgba(30, 111, 124, 0.12);
    border-color: var(--color-ocean);
}

.history-item-title {
    font-weight: 500;
    color: var(--color-earth-deep);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--color-earth-brown);
    opacity: 0.7;
}

.history-item-status {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: var(--radius-full);
    margin-top: var(--space-xs);
}

.status-sent {
    background: rgba(74, 124, 89, 0.15);
    color: var(--color-success);
}

.status-draft {
    background: rgba(184, 134, 11, 0.15);
    color: var(--color-warning);
}

.status-reviewing {
    background: rgba(30, 111, 124, 0.15);
    color: var(--color-ocean);
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.view {
    display: none;
    height: 100%;
}

.view.active {
    display: block;
}

/* Compose View */
.compose-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.compose-header {
    margin-bottom: var(--space-xl);
}

.compose-header h2 {
    margin-bottom: var(--space-sm);
}

.compose-header p {
    color: var(--color-earth-brown);
}

.compose-form {
    padding: var(--space-xl);
}

/* File Upload */
.file-upload-section {
    margin-bottom: var(--space-lg);
}

.file-upload-section > label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--color-earth-brown);
}

.file-drop-zone {
    position: relative;
    border: 2px dashed var(--color-sand);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--color-ocean);
    background: rgba(30, 111, 124, 0.05);
}

.file-drop-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-content svg {
    width: 48px;
    height: 48px;
    color: var(--color-sand);
    margin-bottom: var(--space-md);
}

.drop-content p {
    color: var(--color-earth-brown);
    margin-bottom: var(--space-xs);
}

.file-types {
    font-size: 0.75rem;
    color: var(--color-earth-brown);
    opacity: 0.7;
}

.file-list {
    margin-top: var(--space-md);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--color-white);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.file-icon {
    width: 36px;
    height: 36px;
    background: rgba(30, 111, 124, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-ocean);
}

.file-icon svg {
    width: 20px;
    height: 20px;
}

.file-name {
    font-weight: 500;
    color: var(--color-earth-deep);
}

.file-size {
    font-size: 0.75rem;
    color: var(--color-earth-brown);
}

.file-remove {
    padding: var(--space-sm);
    background: none;
    border: none;
    color: var(--color-error);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.file-remove:hover {
    opacity: 1;
}

.compose-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

/* Chat View */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-md);
    margin-bottom: 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.status-indicator .dot {
    width: 10px;
    height: 10px;
    background: var(--color-ocean);
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.status-indicator.complete .dot {
    background: var(--color-success);
    animation: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.message {
    max-width: 80%;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-ai {
    align-self: flex-start;
    background: var(--color-white);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: var(--radius-sm);
}

.message-user {
    align-self: flex-end;
    background: var(--color-ocean);
    color: var(--color-white);
    border-bottom-right-radius: var(--radius-sm);
}

.message-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    opacity: 0.7;
}

.message-content {
    line-height: 1.6;
}

.message-content p {
    margin-bottom: var(--space-md);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.chat-input-area {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-md);
}

.chat-input-area textarea {
    flex: 1;
    min-height: auto;
    resize: none;
}

.chat-input-area .btn {
    padding: var(--space-md);
}

/* Success View */
.success-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: var(--space-xl);
}

.success-card {
    max-width: 500px;
    padding: var(--space-2xl);
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-xl);
    background: rgba(74, 124, 89, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-success);
}

.success-icon svg {
    width: 40px;
    height: 40px;
}

.success-card h2 {
    margin-bottom: var(--space-md);
    color: var(--color-success);
}

.success-details {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    background: var(--color-white);
    border-radius: var(--radius-md);
    text-align: left;
}

.success-details h4 {
    font-size: 0.875rem;
    color: var(--color-earth-brown);
    margin-bottom: var(--space-sm);
}

.success-details ul {
    list-style: none;
    font-size: 0.875rem;
}

.success-details li {
    padding: var(--space-xs) 0;
    color: var(--color-earth-deep);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.toast {
    padding: var(--space-md) var(--space-lg);
    background: var(--color-earth-deep);
    color: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease;
}

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

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }
.toast.warning { background: var(--color-warning); }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 36, 24, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

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

.loading-spinner {
    text-align: center;
    color: var(--color-white);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-lg);
}

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

/* Responsive */
@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .compose-container {
        padding: var(--space-md);
    }
    
    .compose-form {
        padding: var(--space-lg);
    }
    
    .message {
        max-width: 90%;
    }
    
    h1 { font-size: 2rem; }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-sand);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-earth-brown);
}
