:root {
    --primary-green: #059669;
    --light-green: #d1fae5;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --danger-color: #ef4444;
    --hover-row: #f9fafb;
    --selected-row: #e0f2fe;
    --focus-row: #f0fdf4;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
}

.container {
    width: 100%;
    max-width: 1900px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 60px;
}

.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    width: 100%;
    align-items: start;
}

/* --- Header --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -1px;
}

.status-badge {
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
}

.status-dot.online {
    background-color: var(--primary-green);
    box-shadow: 0 0 0 2px var(--light-green);
}

.status-dot.error {
    background-color: var(--danger-color);
}

/* --- Google Button Styles --- */
.google-btn {
    background-color: #4285F4;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px;
    display: flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    transition: box-shadow .2s ease, background-color .2s ease;
    font-family: 'Roboto', sans-serif;
    height: 40px;
    text-decoration: none;
}

.google-btn:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    background-color: #357ae8;
}

.google-btn:active {
    background-color: #3367D6;
}

.google-icon-wrapper {
    background: white;
    width: 36px;
    height: 36px;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
}

.google-btn-text {
    color: white;
    font-size: 14px;
    letter-spacing: 0.2px;
    font-weight: 500;
    margin-right: 12px;
}

/* Logout button style (simple) */
.logout-btn {
    background-color: #f3f4f6;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.logout-btn:hover {
    background-color: #e5e7eb;
    color: var(--danger-color);
    border-color: #d1d5db;
}

/* Auth button loading state */
.auth-btn-loading {
    background-color: #f3f4f6;
    color: var(--text-light);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: not-allowed;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-btn-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-light);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Navigation Sidebar --- */
.nav-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--card-bg);
    padding: 20px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.nav-tab {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    border-radius: 8px;
    text-align: left;
}

.nav-tab:hover {
    color: var(--text-dark);
    background-color: var(--bg-color);
}

.nav-tab.active {
    color: var(--primary-green);
    background-color: var(--light-green);
    border-left-color: var(--primary-green);
}

.nav-tab .material-icons {
    font-size: 1.3rem;
    margin-right: 12px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

.content-area {
    width: 100%;
}

/* --- Summary Cards --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 10px;
}

.card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.card-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 8px;
}

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.currency {
    font-size: 1.5rem;
    color: var(--text-light);
    font-weight: 400;
    margin-right: 4px;
}

.card.available .card-value {
    color: var(--primary-green);
}

.progress-container {
    margin-top: 15px;
    background-color: var(--bg-color);
    border-radius: 10px;
    height: 8px;
    width: 100%;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--primary-green);
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
    display: block;
}

/* --- Filter Controls (Reusable) --- */
.filter-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input,
.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-dark);
    background-color: var(--card-bg);
    transition: all 0.2s;
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.filter-input::placeholder {
    color: var(--text-light);
}

.filter-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    appearance: none;
}

/* --- Honeymoon Controls (Legacy - for backwards compatibility) --- */
.honeymoon-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.honeymoon-filter-input,
.honeymoon-filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-dark);
    background-color: var(--card-bg);
    transition: all 0.2s;
}

.honeymoon-filter-input {
    flex: 1;
    min-width: 200px;
}

.honeymoon-filter-input:focus,
.honeymoon-filter-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.honeymoon-filter-input::placeholder {
    color: var(--text-light);
}

.honeymoon-filter-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    appearance: none;
}

/* --- Table --- */
.table-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-primary {
    background-color: var(--text-dark);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background-color: var(--light-gray);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

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

.btn-loading {
    position: relative;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 6px;
    animation: spin 0.6s linear infinite;
}

.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead {
    background-color: #f9fafb;
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 20px 24px;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background-color: #e5e7eb;
    color: var(--text-dark);
}

th.sortable::after {
    content: '↕';
    margin-left: 5px;
    opacity: 0.3;
    font-size: 0.7rem;
}

td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 1rem;
}

tr:hover {
    background-color: var(--hover-row);
}

tr.selected {
    background-color: var(--selected-row) !important;
}

tr:focus-within {
    background-color: var(--focus-row);
}

.editable {
    border: 1px dashed transparent;
    cursor: text;
    padding: 8px;
    border-radius: 4px;
    min-height: 24px;
    position: relative;
    background: transparent;
    transition: all 0.15s ease;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.editable::before {
    content: '✎';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #d1d5db;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.editable:hover {
    border-color: #d1d5db;
    background: rgba(255, 255, 255, 0.5);
}

.editable:hover::before {
    opacity: 1;
}

.editable:focus {
    outline: 2px solid var(--primary-green);
    border-color: var(--primary-green);
    background: white;
}

.editable.completed {
    text-decoration: line-through;
    color: var(--text-light);
}

/* Save state indicators */
.save-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    font-size: 0.8rem;
}

.save-indicator.pending {
    animation: spin 0.6s linear infinite;
    color: #f59e0b;
}

.save-indicator.saved {
    color: #10b981;
    animation: popIn 0.4s ease-out;
}

.save-indicator.error {
    color: #ef4444;
    animation: shake 0.4s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Styles for links inside editable fields */
.editable a {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

.editable a:hover {
    color: #1e40af;
}

.row-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--text-dark);
}

.todo-completed-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-green);
}

/* Badges & Selects */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.category-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: center;
    font-family: inherit;
}

.category-select:focus {
    outline: 2px solid var(--text-dark);
}

.category-select option {
    background-color: white;
    color: var(--text-dark);
}

.cat-venue { background-color: #dbeafe; color: #1e40af; }
.cat-dessert { background-color: #fce7f3; color: #9d174d; }
.cat-decor { background-color: #d1fae5; color: #065f46; }
.cat-photo { background-color: #ede9fe; color: #5b21b6; }
.cat-attire { background-color: #ffedd5; color: #9a3412; }
.cat-travel { background-color: #e0f2fe; color: #075985; }
.cat-misc { background-color: #f3f4f6; color: #4b5563; }

/* Honeymoon category styles */
.cat-food { background-color: #fef3c7; color: #92400e; }
.cat-cultural { background-color: #e0e7ff; color: #3730a3; }
.cat-shopping { background-color: #fce7f3; color: #9d174d; }
.cat-nature { background-color: #d1fae5; color: #065f46; }
.cat-museum { background-color: #dbeafe; color: #1e40af; }
.cat-temple { background-color: #ede9fe; color: #5b21b6; }
.cat-other { background-color: #f3f4f6; color: #4b5563; }

.cost-column {
    font-family: 'Inter', monospace;
    font-weight: 600;
    text-align: right;
}

tfoot td {
    background-color: var(--text-dark);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    border-top: 2px solid var(--text-dark);
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.floating-toolbar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-dark);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 50;
}

.floating-toolbar.visible {
    transform: translateX(-50%) translateY(0);
}

.toolbar-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.toolbar-btn:hover {
    background-color: #dc2626;
}

.toolbar-text {
    font-weight: 500;
}

.editable-wrapper {
    width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
}

/* --- View Display --- */
[data-view] {
    width: 100%;
}

/* --- Todo-specific styles --- */
.todo-stats {
    display: inline-block;
    padding: 8px 16px;
    background: var(--light-green);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--primary-green);
    font-weight: 600;
}

/* Task row content with expand/collapse */
.task-row-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expand-icon {
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    color: var(--text-light);
    width: 16px;
    display: inline-block;
    text-align: center;
    transition: color 0.2s;
}

.expand-icon:hover {
    color: var(--primary-green);
}

.expand-icon-placeholder {
    width: 16px;
    display: inline-block;
}

.drag-handle {
    cursor: grab;
    user-select: none;
    font-size: 0.75rem;
    color: var(--text-light);
    width: 16px;
    display: inline-block;
    text-align: center;
    margin-right: 4px;
    transition: color 0.2s;
}

.drag-handle:hover {
    color: var(--primary-green);
}

.dragging .drag-handle {
    cursor: grabbing;
    opacity: 0.6;
}

/* Sub-task styling */
.subtask-row {
    background-color: #fafafa;
}

.subtask-row:hover {
    background-color: var(--hover-row);
}

.subtask-row .editable {
    font-size: 0.95rem;
    color: var(--text-light);
}

/* Add sub-task button */
.add-subtask-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.add-subtask-btn:hover {
    background: #047857;
}

/* Drag and drop styles */
#todo-body tr {
    transition: opacity 0.2s ease;
}

#todo-body tr.dragging {
    opacity: 0.5;
    background-color: var(--primary-green);
    color: white;
}

#todo-body tr:not(.dragging):hover {
    cursor: grab;
}

#todo-body tr[data-level="1"] {
    cursor: default !important;
}

/* --- Honeymoon-specific styles --- */
.star-rating {
    display: flex;
    gap: 2px;
    justify-content: center;
    cursor: pointer;
}

.star {
    font-size: 1.2rem;
    color: #e5e7eb;
    cursor: pointer;
    transition: color 0.2s ease;
}

.star:hover,
.star.filled {
    color: #fbbf24;
}

.visited-row {
    background-color: #f0fdf4;
}

.visited-row td {
    text-decoration: line-through;
    color: #9ca3af;
    border-bottom-color: var(--border-color);
    opacity: 0.7;
}

.visited-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cell-name {
    font-weight: 500;
}

/* Empty State Styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    background: var(--card-bg);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 24px;
    max-width: 400px;
}

.empty-state-action {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.empty-state-action:hover {
    background-color: #047857;
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .nav-sidebar {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding: 12px 8px;
        position: relative;
        top: 0;
        sticky: unset;
    }
    
    body {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    header {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-tab {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}
