/* === GARDEN APP v2 - UPGRADED CSS === */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --green-dark: #1a5c2e;
    --green-main: #2d8a4e;
    --green-light: #4caf50;
    --green-pale: #e8f5e9;
    --green-bg: #f1f8e9;
    --orange: #ff9800;
    --red: #e53935;
    --blue: #1976d2;
    --pink: #e91e63;
    --purple: #9c27b0;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-600: #757575;
    --gray-800: #424242;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Rubik', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--green-bg);
    color: var(--gray-800);
    direction: rtl;
    height: 100vh;
    overflow: hidden;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a5c2e 0%, #2d8a4e 50%, #4caf50 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-logo { font-size: 4em; margin-bottom: 8px; }

.login-card h1 {
    font-size: 2em;
    color: var(--green-dark);
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--gray-600);
    font-size: 1em;
    margin-bottom: 20px;
}

.login-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.login-features span {
    background: var(--green-pale);
    color: var(--green-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.login-choose {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
    font-family: 'Rubik', sans-serif;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.login-btn.sarit { border-color: var(--pink); }
.login-btn.sarit:hover { background: #fce4ec; }
.login-btn.gal { border-color: var(--blue); }
.login-btn.gal:hover { background: #e3f2fd; }
.login-btn.morbi { border-color: var(--purple); }
.login-btn.morbi:hover { background: #f3e5f5; }

.login-btn-emoji { font-size: 2em; width: 48px; text-align: center; }

.login-btn-info { display: flex; flex-direction: column; }

.login-btn-name { font-size: 1.1em; font-weight: 600; color: var(--gray-800); }
.login-btn-role { font-size: 0.85em; color: var(--gray-600); }

.login-footer { margin-top: 20px; font-size: 0.8em; color: var(--gray-600); }

/* ===== APP LAYOUT ===== */
.app-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto auto 1fr;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--green-dark);
    color: white;
    padding: 0 20px;
    z-index: 100;
}

.header-right h1 { font-size: 1.2em; font-weight: 600; white-space: nowrap; }
.header-center { display: flex; gap: 8px; }
.header-left { display: flex; align-items: center; gap: 8px; }

.header-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    font-size: 0.85em;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-btn:hover { background: rgba(255,255,255,0.25); }
.header-btn.active { background: var(--green-light); font-weight: 600; }

.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

/* ===== CHAT AREA ===== */
.chat-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--green-pale), #c8e6c9);
    padding: 16px 20px;
    margin: 12px;
    border-radius: var(--radius);
    position: relative;
    border: 1px solid #a5d6a7;
    flex-shrink: 0;
}

.welcome-close {
    position: absolute;
    top: 8px;
    left: 8px;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--gray-600);
    padding: 4px;
}

.welcome-text {
    font-size: 0.92em;
    line-height: 1.6;
    color: var(--green-dark);
}

.welcome-text strong { display: block; font-size: 1.05em; margin-bottom: 4px; }

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-100);
    flex-shrink: 0;
}

.quick-btn {
    background: white;
    border: 1px solid var(--gray-300);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    font-size: 0.82em;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--gray-800);
}

.quick-btn:hover {
    background: var(--green-pale);
    border-color: var(--green-light);
}

.quick-btn.private {
    background: #f3e5f5;
    border-color: #ce93d8;
    color: #6a1b9a;
}

.quick-btn.private:hover {
    background: #e1bee7;
    border-color: #ab47bc;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.load-more {
    text-align: center;
    padding: 8px;
}

.load-more button {
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    font-size: 0.8em;
    color: var(--gray-600);
}

.load-more button:hover {
    background: var(--green-pale);
    border-color: var(--green-light);
}

.message {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 16px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
    font-size: 0.95em;
}

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

.message.own {
    align-self: flex-start;
    background: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.message.other {
    align-self: flex-end;
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.message.ai {
    align-self: center;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: 1px solid #a5d6a7;
    max-width: 88%;
}

.message.system {
    align-self: center;
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    font-size: 0.85em;
    color: var(--gray-600);
    max-width: 90%;
    text-align: center;
    padding: 6px 14px;
}

.message.alert {
    align-self: center;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    font-size: 0.85em;
    max-width: 90%;
    text-align: center;
    padding: 6px 14px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.82em;
    font-weight: 600;
}

.message-header .sender-sarit { color: var(--pink); }
.message-header .sender-gal { color: var(--blue); }
.message-header .sender-morbi { color: var(--purple); }
.message-header .sender-ai { color: var(--green-dark); }

.message-time {
    font-size: 0.72em;
    color: var(--gray-600);
    margin-top: 4px;
    text-align: left;
}

/* Chat Input */
.chat-input-area {
    border-top: 1px solid var(--gray-200);
    padding: 8px 16px 12px;
    background: white;
    flex-shrink: 0;
}

.input-hint {
    font-size: 0.75em;
    color: var(--gray-600);
    padding: 4px 8px;
    margin-bottom: 6px;
    transition: all 0.3s;
}

.input-hint.hidden { opacity: 0; height: 0; margin: 0; padding: 0; overflow: hidden; }

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: 24px;
    font-family: 'Rubik', sans-serif;
    font-size: 0.95em;
    outline: none;
    direction: rtl;
    transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--green-light); }

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--green-main);
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover { background: var(--green-dark); transform: scale(1.05); }

.voice-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-btn:hover { border-color: var(--green-light); background: var(--green-pale); }
.voice-btn.recording {
    background: #ffebee;
    border-color: var(--red);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== SIDEBAR ===== */
.sidebar {
    background: var(--gray-100);
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-section h3 {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.add-btn {
    background: var(--green-light);
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: 'Rubik', sans-serif;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn:hover { background: var(--green-dark); }

/* Budget Card */
.budget-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 12px;
    box-shadow: var(--shadow);
}

.budget-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.budget-total .amount {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--green-dark);
}

.budget-bar {
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.budget-bar-fill {
    height: 100%;
    background: var(--green-light);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.budget-bar-fill.warning { background: var(--orange); }
.budget-bar-fill.danger { background: var(--red); }

.budget-details { font-size: 0.8em; color: var(--gray-600); }

/* Budget Alerts */
#budget-alerts .alert-item {
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.82em;
}

#budget-alerts .alert-item.danger {
    background: #ffebee;
    border-color: #ef9a9a;
}

/* Category list */
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.82em;
}

.category-item:last-child { border-bottom: none; }

.cat-bar {
    width: 50px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 8px;
    display: inline-block;
}

.cat-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--green-light);
}

.cat-bar-fill.warning { background: var(--orange); }
.cat-bar-fill.danger { background: var(--red); }

.category-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
}

.category-status.done { background: #e8f5e9; color: #2e7d32; }
.category-status.progress { background: #fff3e0; color: #e65100; }
.category-status.waiting { background: #fce4ec; color: #c62828; }

/* Tasks Widget */
.task-item {
    background: white;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    transition: all 0.2s;
}

.task-item:hover { box-shadow: var(--shadow); }
.task-item { cursor: pointer; }

.task-priority {
    width: 4px;
    min-height: 30px;
    border-radius: 2px;
    flex-shrink: 0;
}

.task-priority.high { background: var(--red); }
.task-priority.medium { background: var(--orange); }
.task-priority.low { background: var(--green-light); }

.task-info { flex: 1; }

.task-title { font-size: 0.85em; font-weight: 500; margin-bottom: 2px; }

.task-meta { font-size: 0.72em; color: var(--gray-600); }

.task-assignee {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 500;
}

.task-assignee.gal { background: #e3f2fd; color: var(--blue); }
.task-assignee.sarit { background: #fce4ec; color: var(--pink); }
.task-assignee.morbi { background: #f3e5f5; color: var(--purple); }

/* Online Users */
.online-users { display: flex; gap: 6px; flex-wrap: wrap; }

.online-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: white;
    border-radius: 12px;
    font-size: 0.82em;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-light);
    animation: blink 2s infinite;
}

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

/* ===== DASHBOARD ===== */
.dashboard-view {
    overflow-y: auto;
    padding: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    padding: 16px;
}

.dash-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.dash-card h3 {
    font-size: 1em;
    color: var(--green-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--green-pale);
}

.dash-number { font-size: 2em; font-weight: 700; color: var(--green-dark); }
.dash-label { font-size: 0.85em; color: var(--gray-600); }

/* ===== MODALS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    font-size: 1.2em;
    color: var(--green-dark);
    margin-bottom: 16px;
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--gray-800);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: 'Rubik', sans-serif;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--green-light);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 16px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Rubik', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--green-main); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-secondary:hover { background: var(--gray-300); }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-container { grid-template-columns: 1fr; }

    .sidebar {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        overflow-y: auto;
    }

    .sidebar.active { display: flex; }

    .header-right h1 { font-size: 1em; }
    .quick-actions { padding: 8px 12px; }
    .quick-btn { font-size: 0.75em; padding: 5px 10px; }
    .message { max-width: 90%; }
    .login-card { padding: 28px 20px; }
    .login-btn-emoji { font-size: 1.5em; width: 36px; }
}

button.logout-btn { background: rgba(255,255,255,0.1); font-size: 0.8em; }
button.logout-btn:hover { background: rgba(255,0,0,0.2); }

/* ===== CHANNEL TABS ===== */
.channel-tabs {
    grid-column: 1 / -1;
    display: flex;
    gap: 0;
    background: #f5f5f5;
    border-bottom: 2px solid var(--gray-200);
    padding: 0;
}

.channel-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-family: 'Rubik', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-600);
    border-bottom: 3px solid transparent;
    text-align: center;
}

.channel-tab:hover {
    background: var(--green-pale);
}

.channel-tab.active {
    color: var(--green-dark);
    border-bottom-color: var(--green-main);
    font-weight: 600;
    background: white;
}

.channel-tab:last-child.active {
    color: #6a1b9a;
    border-bottom-color: #9c27b0;
    background: #faf5ff;
}

/* Privacy Notice */
.privacy-notice {
    grid-column: 1 / 2;
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    padding: 10px 16px;
    font-size: 0.85em;
    color: #4a148c;
    border-bottom: 1px solid #ce93d8;
    line-height: 1.5;
    text-align: center;
}

@media (min-width: 769px) {
    .sidebar-toggle { display: none; }
}
