/* App Container */
#app-container {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: white;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.app-header h1 {
    color: #667eea;
    font-size: 24px;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#username-display {
    font-weight: 600;
    color: #333;
}

.logout-btn {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #e0e0e0;
}

/* Toolbar */
.toolbar {
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn-add {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn-add:hover {
    background: #5568d3;
}

#sort-btn,
#more-actions-btn {
    width: auto;
    color: #667eea;
    flex-shrink: 0;
}

/* Search */
.search-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 180px;
    max-width: 400px;
    position: relative;
    margin-left: auto;
}

#search-input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 15px;
    font-family: inherit;
    color: #333;
    transition: border-color 0.3s, background 0.3s;
    background: rgba(102, 126, 234, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 18px;
    border-radius: 8px 8px 0 0;
}

#search-input:focus {
    outline: none;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.12);
}

#search-input::placeholder {
    color: #999;
}

.search-clear-btn {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s, background 0.2s;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
}

.search-clear-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.search-clear-btn.hidden {
    display: none;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
    flex-shrink: 0;
}

.filter-bar.filter-bar-collapsed {
    display: none !important;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    color: #24292f;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background: #eaeef2;
    border-color: #afb8c1;
}

.filter-btn.active {
    background: #0969da;
    color: #fff;
    border-color: #0969da;
}

/* Visible count badge */
.visible-count {
    background: #667eea;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}

/* Filter Group */
.filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* Custom Date Range */
.custom-range {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.custom-range label {
    font-size: 13px;
    color: #57606a;
}

.custom-range input[type="date"] {
    padding: 5px 8px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: #24292f;
    background: #fff;
}

.custom-range.active {
    border: 1.5px solid #0969da;
    border-radius: 6px;
    padding: 6px 12px;
    background: rgba(9, 105, 218, 0.04);
}

.btn-secondary {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

.custom-range .btn-secondary {
    padding: 5px 12px;
    font-size: 13px;
}

/* Main content area */
.main-content {
    flex: 1;
    overflow: visible;
    padding: 0 5px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Filter Toggle Button */
.filter-toggle-btn {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.filter-toggle-btn:hover {
    background: #e0e0e0;
}

/* Dropdown wrapper & menu */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 240px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 900;
    overflow: hidden;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    color: #333;
    font-weight: 600;
    transition: background 0.15s;
}

.dropdown-menu button:hover {
    background: #f6f8fa;
    border-radius: 6px;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 300px;
    max-width: 440px;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: toast-in 0.3s ease-out;
    pointer-events: none;
    user-select: none;
}

.toast--success {
    background: #2e7d32;
}

.toast--error {
    background: #c62828;
}

.toast--warning {
    background: #e67e22;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
