/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin: 0;
}

/* Sections */
section {
    background: white;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Filter section */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

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

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.filter-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.total-display {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(17, 153, 142, 0.3);
}

/* Table styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

/* Messages */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    margin-bottom: 20px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
    margin-bottom: 20px;
}

.no-expenses {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .total-display {
        text-align: center;
    }
    
    section {
        padding: 15px;
    }
    
    .table-container {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    section h2 {
        font-size: 1.2rem;
    }
    
    .table-container {
        font-size: 12px;
    }
    
    th, td {
        padding: 6px;
    }
    
    .btn-danger {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Animation for new rows */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.new-row {
    animation: slideIn 0.3s ease-out;
}

/* Form validation styles */
.form-group input:invalid,
.form-group select:invalid {
    border-color: #e74c3c;
}

.form-group input:valid,
.form-group select:valid {
    border-color: #27ae60;
}

/* Pill-style Filter Buttons */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.pill-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background-color: #f1f3f5;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.pill-btn:hover {
    background-color: #e9ecef;
    color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pill-btn[data-selected] {
    background: linear-gradient(135deg, #4F46E5 0%, #10B981 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

/* Category Buttons - Same pill-style as filter */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.category-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background-color: #f1f3f5;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.category-btn:hover {
    background-color: #e9ecef;
    color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.category-btn[data-selected] {
    background: linear-gradient(135deg, #4F46E5 0%, #10B981 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

/* Date Filter */
.date-filter {
    width: 100%;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    background-color: white;
    transition: border-color 0.3s ease;
}

.date-filter:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pill-group {
        gap: 6px;
    }
    
    .pill-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .pill-group {
        gap: 4px;
    }
    
    .pill-btn {
        padding: 6px 12px;
        font-size: 12px;
        min-height: 32px;
    }
}
