/**
 * EXPENSES.CSS
 * Operating expenses tab styling with glass-panel theme consistency
 */

/* Import shared glass-input and button styles */
.glass-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: all 0.3s ease;
}

.glass-input:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    cursor: not-allowed;
}

.glass-input:focus {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    outline: none;
}

.btn-gold {
    background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
    color: #000;
    font-weight: 700;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.expenses-container {
    padding: 1.5rem;
    background-color: transparent;
    color: var(--text-primary);
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-filter {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.time-filter select {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 120px;
}

.time-filter select:focus {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    outline: none;
}

.analysis-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 215, 0, 0.2);
}

.kpi-card h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kpi-card h3::before {
    content: '📊';
    font-size: 1rem;
}

.category-list, .spender-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-name {
    color: var(--text-primary);
    font-weight: 500;
    min-width: 120px;
}

.category-amount {
    color: #FFD700;
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #B8860B);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.spender-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    transition: background 0.3s ease;
}

.spender-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.spender-rank {
    color: #FFD700;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
    font-size: 1.1rem;
}

.spender-name {
    flex-grow: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.spender-amount {
    color: #FFD700;
    font-weight: 600;
    text-align: right;
    min-width: 100px;
}

.input-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.input-bar input, .input-bar select {
    flex-grow: 1;
    min-width: 120px;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-family: inherit;
    transition: all 0.3s ease;
}

.input-bar input:focus, .input-bar select:focus {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    outline: none;
    background: rgba(0, 0, 0, 0.5);
}

#add-expense-btn {
    background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
    color: #000;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 80px;
}

#add-expense-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

#add-expense-btn:active {
    transform: translateY(0);
}

#cancel-expense-btn {
    background: rgba(107, 114, 128, 0.3);
    color: #d1d5db;
    border: 1px solid rgba(107, 114, 128, 0.5);
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 80px;
}

#cancel-expense-btn:hover {
    background: rgba(107, 114, 128, 0.5);
    border-color: rgba(107, 114, 128, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3);
}

#cancel-expense-btn:active {
    transform: translateY(0);
}

.expense-list-container {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    overflow: visible;
    position: relative;
    z-index: 0;
}

.expense-list-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 0.8fr 1fr 1.5fr 1fr 0.8fr 1.2fr;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #FFD700;
    background-color: rgba(255, 215, 0, 0.05);
    position: sticky;
    top: 0;
    text-align: center;
}

.expense-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 0.8fr 1fr 1.5fr 1fr 0.8fr 1.2fr;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: background 0.3s ease;
    align-items: center;
    text-align: center;
}

.expense-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.expense-list {
    max-height: none;
    overflow-y: visible;
}

.edit-btn {
    background: rgba(255, 215, 0, 0.2);
    color: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.4);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.edit-btn:hover {
    background: rgba(255, 215, 0, 0.4);
    border-color: #FFD700;
}

.delete-btn {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(220, 53, 69, 0.4);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 0.4);
    border-color: #ff6b6b;
}

/* Responsive Button Sizing */
@media (max-width: 1024px) {
    .edit-btn,
    .delete-btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    .edit-btn,
    .delete-btn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.65rem !important;
    }
}

.receipt-btn {
    background: rgba(59, 130, 246, 0.2);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.receipt-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    border-color: #3B82F6;
}

.expense-list-footer {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
    margin-top: 0;
    font-weight: 700;
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
    background: rgba(255, 215, 0, 0.05);
    color: var(--text-primary);
}

/* ✅ 상세 검색 모달 스타일 */
.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-advanced-search {
    background: rgba(255, 255, 255, 0.05);
    color: #FFD700;
    border: 1.5px solid rgba(255, 215, 0, 0.3);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 130px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-advanced-search:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 215, 0, 0.03);
}

.modal-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #fff;
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.filter-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-input:focus {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    outline: none;
    background: rgba(0, 0, 0, 0.5);
}

.date-range {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-range .filter-input {
    flex: 1;
}

.date-separator {
    color: #9ca3af;
    font-weight: 500;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.modal-action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-reset {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
    border: 1px solid rgba(107, 114, 128, 0.4);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: rgba(107, 114, 128, 0.4);
    border-color: rgba(107, 114, 128, 0.6);
}

.btn-cancel-modal {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
    border: 1px solid rgba(107, 114, 128, 0.4);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-cancel-modal:hover {
    background: rgba(107, 114, 128, 0.4);
    border-color: rgba(107, 114, 128, 0.6);
}

.btn-apply-filters {
    background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
    color: #000;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-apply-filters:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-controls {
        width: 100%;
        flex-direction: column;
    }

    .time-filter {
        width: 100%;
    }

    .time-filter select {
        flex: 1;
        min-width: 0;
    }

    .btn-advanced-search {
        width: 100%;
        min-width: auto;
    }

    .analysis-panel {
        grid-template-columns: 1fr;
    }

    .input-bar {
        flex-direction: column;
    }

    .input-bar input, .input-bar select {
        width: 100%;
    }

    #add-expense-btn {
        width: 100%;
    }

    .expense-list-header,
    .expense-item {
        grid-template-columns: repeat(3, 1fr);
        font-size: 0.85rem;
    }

    .expense-list-header,
    .expense-item {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-action-buttons {
        flex-direction: column;
    }

    .modal-action-buttons button {
        width: 100%;
    }

    .btn-reset {
        width: 100%;
    }
}
