/* ==========================================================================
   DESIGN SYSTEM & CUSTOM PROPERTIES (LIGHT PREMIUM THEME)
   ========================================================================== */
:root {
    /* Brand Colors */
    --primary-gradient: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
    --primary-color: #7C3AED;
    --primary-hover: #6D28D9;
    --primary-light: #F5F3FF;
    --primary-glow: rgba(124, 58, 237, 0.15);
    
    /* Semantic Colors */
    --success-color: #10B981;
    --success-bg: #ECFDF5;
    --success-glow: rgba(16, 185, 129, 0.15);
    --warning-color: #F59E0B;
    --warning-bg: #FFFBEB;
    --warning-glow: rgba(245, 158, 11, 0.15);
    --danger-color: #EF4444;
    --danger-bg: #FEF2F2;
    --danger-hover: #DC2626;

    /* Neutrals - Premium Slate Scale */
    --bg-main: #F8FAFC;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border-color: rgba(226, 232, 240, 0.8);
    
    /* Glassmorphism settings */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 10px 30px rgba(100, 116, 139, 0.06), 
                    0 1px 3px rgba(100, 116, 139, 0.02);
    --card-shadow: 0 4px 20px rgba(100, 116, 139, 0.04);
    --card-shadow-hover: 0 12px 30px rgba(100, 116, 139, 0.09);

    /* Border Radius & Transitions */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   RESET & CORE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Blobs */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.55;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background-color: #E9D5FF; /* Soft Purple */
    animation-duration: 25s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background-color: #CCFBF1; /* Soft Mint/Teal */
    animation-duration: 30s;
    animation-delay: -5s;
}

.blob-3 {
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background-color: #DBEAFE; /* Soft Blue */
    animation-duration: 22s;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(40px, -60px) scale(1.1) rotate(180deg); }
    100% { transform: translate(-30px, 40px) scale(0.9) rotate(360deg); }
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

/* Glass Panel Styling */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
    transition: var(--transition-smooth);
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
}

.logo-icon i {
    width: 24px;
    height: 24px;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #1E293B 30%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ==========================================================================
   DASHBOARD STATS
   ========================================================================== */
.dashboard-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.5rem;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-wrapper i {
    width: 22px;
    height: 22px;
}

/* Color Coding for Stats */
.stat-icon-wrapper.blue { background-color: #EFF6FF; color: #3B82F6; }
.stat-icon-wrapper.green { background-color: #ECFDF5; color: #10B981; }
.stat-icon-wrapper.orange { background-color: #FFFBEB; color: #F59E0B; }
.stat-icon-wrapper.purple { background-color: #F5F3FF; color: #7C3AED; }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value small {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 0.2rem;
}

.total-budget-card {
    border-left: none;
    padding-left: 0;
}

@media (min-width: 1025px) {
    .total-budget-card {
        border-left: 1px dashed var(--border-color);
        padding-left: 1.5rem;
    }
}

/* ==========================================================================
   MAIN WORKSPACE
   ========================================================================== */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Form Styles */
.form-section {
    padding: 2rem;
    position: sticky;
    top: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.section-title i {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.shopping-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.required {
    color: var(--danger-color);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: rgba(248, 250, 252, 0.8);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-smooth);
}

.input-wrapper textarea {
    padding-top: 0.75rem;
    resize: none;
}

.textarea-icon {
    top: 0.85rem;
}

.input-wrapper input::placeholder,
.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

/* Input Focus States */
.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

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

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-tip {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: -0.2rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   BUTTONS STYLING
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-bounce);
}

.btn i {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
    flex-grow: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}

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

.btn-secondary {
    background-color: #F1F5F9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #E2E8F0;
    transform: translateY(-1px);
}

.btn-secondary-glow {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid rgba(124, 58, 237, 0.25);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.05);
}

.btn-secondary-glow:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-icon-only {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0;
}

.btn-icon-only:hover {
    background-color: #F8FAFC;
    color: var(--primary-color);
    border-color: rgba(124, 58, 237, 0.2);
    transform: translateY(-2px);
}

/* ==========================================================================
   LIST SECTION: FILTER & CONTROLS
   ========================================================================== */
.list-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: rgba(248, 250, 252, 0.8);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.filter-sort-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-tabs {
    display: flex;
    gap: 0.4rem;
    background-color: #F1F5F9;
    padding: 0.3rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.filter-tab {
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-tab.active {
    background-color: white;
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(100, 116, 139, 0.08);
}

.filter-tab:hover:not(.active) {
    color: var(--text-primary);
}

.sort-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.sort-icon {
    position: absolute;
    left: 0.85rem;
    width: 15px;
    height: 15px;
    color: var(--text-secondary);
    pointer-events: none;
}

.sort-wrapper select {
    padding: 0.45rem 1rem 0.45rem 2.2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: white;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sort-wrapper select:focus {
    border-color: var(--primary-color);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    border-radius: var(--radius-lg);
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.empty-icon i {
    width: 32px;
    height: 32px;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.5;
}

/* ==========================================================================
   SHOPPING ITEMS LIST
   ========================================================================== */
.items-list-wrapper {
    min-height: 200px;
}

.shopping-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Item Card base */
.item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    gap: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    animation: slideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.item-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--text-muted);
    transition: var(--transition-smooth);
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
    background: white;
}

/* Animation on entry */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Left part: Checkbox and Details */
.item-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-grow: 1;
}

/* Custom Status Dropdown in Card */
.item-status-dropdown-wrapper {
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.item-status-dropdown {
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.item-status-dropdown.pending {
    color: var(--warning-color);
    background-color: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.2);
}

.item-status-dropdown.bought {
    color: var(--success-color);
    background-color: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.2);
}

.item-status-dropdown:focus {
    box-shadow: 0 0 0 3px var(--primary-glow);
    border-color: var(--primary-color);
}

/* Item details text */
.item-details {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.item-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.item-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}



/* Metadata (Price, Notes) */
.item-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 1rem;
    row-gap: 0.3rem;
}

.item-price {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--primary-color);
}

.item-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.item-notes i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

/* Right part: Actions */
.item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Action button variations */
.btn-action {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-action i {
    width: 16px;
    height: 16px;
}

.btn-visit {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.btn-visit:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-edit-item:hover {
    background-color: #F1F5F9;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-delete-item {
    color: var(--text-muted);
}

.btn-delete-item:hover {
    background-color: var(--danger-bg);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   ITEM CARD CONDITIONAL STATES (STATUS)
   ========================================================================== */
/* BOUGHT STATE */
.item-card.bought {
    background: rgba(248, 250, 252, 0.5);
    border-color: rgba(16, 185, 129, 0.15);
}

.item-card.bought::before {
    background-color: var(--success-color);
}

.item-card.bought .item-name {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.item-card.bought .item-price {
    color: var(--text-secondary);
    font-weight: 500;
}



/* PENDING STATE */
.item-card.pending::before {
    background-color: var(--warning-color);
}

/* Card removal animation */
.item-card.removing {
    animation: fadeOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
        margin-bottom: -72px; /* Smooth collapse */
        padding-top: 0;
        padding-bottom: 0;
        height: 0;
        border-top-width: 0;
        border-bottom-width: 0;
        overflow: hidden;
    }
}

/* ==========================================================================
   TOAST SYSTEM
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
    max-width: 350px;
    width: calc(100vw - 4rem);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.04);
    border-left: 4px solid var(--primary-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transform: translateX(120%);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: var(--transition-smooth);
}

.toast.success { border-left-color: var(--success-color); }
.toast.info { border-left-color: var(--primary-color); }
.toast.warning { border-left-color: var(--warning-color); }
.toast.danger { border-left-color: var(--danger-color); }

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon { color: var(--success-color); }
.toast.info .toast-icon { color: var(--primary-color); }
.toast.warning .toast-icon { color: var(--warning-color); }
.toast.danger .toast-icon { color: var(--danger-color); }

.toast-message {
    flex-grow: 1;
}

.toast.removing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    to { transform: translateX(0); }
}

@keyframes toastOut {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* ==========================================================================
   FOOTER INFO
   ========================================================================== */
.app-footer-info {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px dashed var(--border-color);
    margin-top: 1rem;
}

/* ==========================================================================
   SYNC PANEL STYLES
   ========================================================================== */
.sync-panel-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.sync-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.sync-status-indicator .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #F59E0B; /* Orange for local */
    display: inline-block;
    transition: var(--transition-smooth);
}

.sync-status-indicator.connected .dot {
    background-color: #10B981; /* Green for connected */
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.sync-status-indicator.syncing .dot {
    background-color: #3B82F6; /* Blue for syncing */
    animation: pulseSync 1s infinite alternate ease-in-out;
}

@keyframes pulseSync {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1.3); opacity: 0.5; }
}

.sync-input-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sync-input-group input {
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    outline: none;
    background-color: white;
    width: 140px;
    transition: var(--transition-smooth);
    color: var(--text-primary);
}

.sync-input-group input:focus {
    border-color: var(--primary-color);
    width: 180px;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-connect-sync {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-connect-sync:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-connect-sync.connected {
    background-color: #FEF2F2;
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.btn-connect-sync.connected:hover {
    background-color: var(--danger-bg);
    border-color: var(--danger-color);
}

.btn-refresh-sync {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    padding: 0;
}

/* ==========================================================================
   DRAWER, BACKDROP & FAB BASE STYLES (DESKTOP)
   ========================================================================== */
.drawer-header {
    display: none;
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.fab-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    outline: none;
    cursor: pointer;
    z-index: 990;
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.35);
    display: none; /* Mobile only */
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
    animation: pulseGlow 2s infinite;
}

.fab-btn i {
    width: 26px;
    height: 26px;
}

.fab-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.5);
}

.fab-btn:active {
    transform: scale(0.9);
}

@keyframes pulseGlow {
    0% { box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3); }
    50% { box-shadow: 0 12px 30px rgba(124, 58, 237, 0.55); }
    100% { box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3); }
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */

/* Breakpoint for Tablet/Mobile Grid Collapse */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    /* Dashboard Layout: 2x2 Grid on Mobile/Tablet */
    .dashboard-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
        padding: 1.25rem;
    }

    /* FAB Display */
    .fab-btn {
        display: flex;
    }

    /* Form Section as a Bottom Sheet Drawer */
    .form-section {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: translateY(105%);
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        max-height: 85vh;
        overflow-y: auto;
        box-shadow: 0 -10px 35px rgba(30, 41, 59, 0.12);
        padding: 1.25rem 1.75rem 2.5rem 1.75rem;
        background: white;
        border: 1px solid var(--border-color);
        border-bottom: none;
    }

    .form-section.active {
        transform: translateY(0);
    }

    /* Drawer header with handle & close button */
    .drawer-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        margin-bottom: 1.25rem;
        width: 100%;
    }

    .drawer-handle {
        width: 44px;
        height: 5px;
        border-radius: 10px;
        background-color: var(--text-muted);
        opacity: 0.4;
    }

    .btn-close-drawer {
        position: absolute;
        top: -8px;
        right: -8px;
        background-color: #F1F5F9;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: var(--transition-smooth);
    }

    .btn-close-drawer:hover {
        background-color: #E2E8F0;
        color: var(--text-primary);
    }

    /* Make sure sticky position is disabled on mobile */
    .form-section {
        position: fixed; /* Override sticky */
        top: auto;
    }

    .app-footer-info {
        padding-bottom: 5.5rem; /* Add padding so FAB doesn't overlap text */
    }
}

/* Breakpoint for Mobile Portrait */
@media (max-width: 600px) {
    .app-container {
        padding: 1.25rem 1rem;
        gap: 1.25rem;
    }
    
    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-actions {
        justify-content: space-between;
    }
    
    .header-actions .btn {
        flex-grow: 1;
    }

    .form-section {
        padding: 1.25rem 1.25rem 2.5rem 1.25rem;
    }

    /* Dashboard Layout: Compact 2x2 on small mobile */
    .dashboard-section {
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .stat-card {
        gap: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .stat-icon-wrapper {
        width: 38px;
        height: 38px;
        border-radius: var(--radius-sm);
    }
    
    .stat-icon-wrapper i {
        width: 18px;
        height: 18px;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.78rem;
    }

    .controls-panel {
        padding: 1rem;
    }

    .filter-sort-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .filter-tab {
        flex-grow: 1;
        text-align: center;
        padding: 0.5rem 0.25rem;
    }

    .sort-wrapper select {
        width: 100%;
    }

    .toast-container {
        bottom: 1rem;
        right: 1rem;
        width: calc(100vw - 2rem);
    }

    .sync-panel-wrapper {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .sync-input-group {
        width: 100%;
    }
    
    .sync-input-group input {
        flex-grow: 1;
        width: 100%;
    }
    
    .sync-input-group input:focus {
        width: 100%;
    }
}
