/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    padding-bottom: 80px;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.3) 1px, transparent 0);
    background-size: 20px 20px;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Main Content */
.app-main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Sections */
.app-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.app-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard */
.dashboard {
    display: grid;
    gap: 1.5rem;
}

.budget-overview {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.budget-overview h2 {
    color: #2196F3;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.budget-card {
    display: grid;
    gap: 1rem;
}

.budget-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #2196F3;
}

.budget-label {
    font-weight: 500;
    color: #555;
}

.budget-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2196F3;
}

.budget-value.spent {
    color: #F44336;
}

.budget-value.remaining {
    color: #4CAF50;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #FFC107 70%, #F44336 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Quick Actions */
.quick-actions {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.quick-actions h3 {
    color: #2196F3;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #495057;
}

.action-btn:hover {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.action-btn i {
    font-size: 1.5rem;
}

/* Recent Expenses */
.recent-expenses {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.recent-expenses h3 {
    color: #2196F3;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Expenses List */
.expenses-list {
    display: grid;
    gap: 1rem;
}

.expense-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #2196F3;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
}

.expense-info h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.expense-details {
    font-size: 0.9rem;
    color: #666;
}

.expense-amount {
    font-weight: 600;
    font-size: 1.1rem;
    color: #F44336;
}

.expense-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.icon-btn:hover {
    background: #f0f0f0;
}

.icon-btn.edit {
    color: #2196F3;
}

.icon-btn.delete {
    color: #F44336;
}

/* Headers */
.expenses-header,
.budget-header,
.group-header,
.currency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.expenses-header h2,
.budget-header h2,
.group-header h2,
.currency-header h2 {
    color: #2196F3;
    font-size: 1.4rem;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.secondary-btn {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #f8f9fa;
    border-color: #2196F3;
    color: #2196F3;
}

/* Filter Section */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.filter-group label {
    font-weight: 500;
    color: #555;
}

.filter-group select,
.filter-group input {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #2196F3;
}

/* Budget Forms */
.budget-form {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.budget-form h3 {
    color: #2196F3;
    margin-bottom: 1rem;
}

.budget-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.budget-category {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.budget-category label {
    font-weight: 500;
    color: #555;
}

.budget-category input {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.budget-category input:focus {
    outline: none;
    border-color: #2196F3;
}

/* Budget Analysis */
.budget-analysis {
    display: grid;
    gap: 1rem;
}

.category-budget {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 600;
    color: #333;
}

.category-amounts {
    font-size: 0.9rem;
    color: #666;
}

.category-progress {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.category-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.category-progress-fill.safe {
    background: #4CAF50;
}

.category-progress-fill.warning {
    background: #FFC107;
}

.category-progress-fill.danger {
    background: #F44336;
}

/* Group Section */
.group-members,
.group-expenses,
.settlement {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.group-members h3,
.group-expenses h3,
.settlement h3 {
    color: #2196F3;
    margin-bottom: 1rem;
}

.members-list {
    display: grid;
    gap: 1rem;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #4CAF50;
}

.member-info h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.member-email {
    font-size: 0.9rem;
    color: #666;
}

.shared-expenses-list,
.settlement-list {
    display: grid;
    gap: 1rem;
}

.shared-expense-item,
.settlement-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #9C27B0;
}

.settlement-item.positive {
    border-left-color: #4CAF50;
}

.settlement-item.negative {
    border-left-color: #F44336;
}

/* Currency Section */
.currency-converter,
.exchange-rates {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.converter-form {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.input-group label {
    font-weight: 500;
    color: #555;
}

.input-group input,
.input-group select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #2196F3;
}

.conversion-result {
    padding: 1.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 12px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1976D2;
    margin-top: 1rem;
}

.rates-list {
    display: grid;
    gap: 0.5rem;
}

.rate-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

/* FAQ Section */
.faq-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.faq-section h2 {
    color: #2196F3;
    margin-bottom: 1.5rem;
    text-align: center;
}

.faq-container {
    display: grid;
    gap: 1rem;
}

.faq-item {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: #333;
    transition: background 0.2s ease;
}

.faq-question:hover {
    background: #e9ecef;
}

.faq-question[aria-expanded="true"] {
    background: #e3f2fd;
    color: #1976D2;
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    animation: slideDown 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    color: #2196F3;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: #f0f0f0;
}

.modal-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2196F3;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #2196F3;
    border-color: #2196F3;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.shared-members-list {
    display: grid;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.member-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Receipt Scanner */
.receipt-scanner {
    padding: 1.5rem;
    text-align: center;
}

#cameraVideo {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.camera-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.ocr-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: left;
}

.ocr-result h4 {
    color: #2196F3;
    margin-bottom: 0.5rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
    min-width: 60px;
}

.nav-item.active {
    color: #2196F3;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem 1rem;
    color: #666;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.8);
    margin-top: 2rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    .app-main {
        padding: 2rem;
    }
    
    .dashboard {
        grid-template-columns: 1fr 1fr;
    }
    
    .budget-overview {
        grid-column: 1 / -1;
    }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .converter-form {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-section {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .bottom-nav {
        display: none;
    }
    
    body {
        padding-bottom: 0;
    }
    
    /* Desktop Navigation */
    .desktop-nav {
        display: flex;
        justify-content: center;
        background: white;
        border-bottom: 1px solid #e0e0e0;
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .desktop-nav .nav-item {
        padding: 0.75rem 1.5rem;
        border-radius: 25px;
        transition: all 0.2s ease;
    }
    
    .desktop-nav .nav-item:hover {
        background: #f0f8ff;
    }
    
    .desktop-nav .nav-item.active {
        background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
        color: white;
    }
}

@media (min-width: 1024px) {
    .dashboard {
        grid-template-columns: 2fr 1fr;
    }
    
    .budget-overview {
        grid-column: 1;
    }
    
    .quick-actions {
        grid-column: 2;
        grid-row: 1 / 3;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .converter-form {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

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

/* Error States */
.error {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    margin: 1rem 0;
}

/* Success States */
.success {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
    margin: 1rem 0;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.hidden { display: none; }
.visible { display: block; }

/* Print Styles */
@media print {
    .bottom-nav,
    .modal,
    .action-buttons,
    .form-actions {
        display: none !important;
    }
    
    .app-section {
        display: block !important;
    }
    
    body {
        background: white;
        color: black;
    }
}
