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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    opacity: 0.9;
    font-weight: 300;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 5px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: 5px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

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

/* Calculator Styles */
.calculator-container,
.scientific-calculator-container {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.calculator-display {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 25px;
    text-align: right;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.previous-operand {
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 8px;
    min-height: 1rem;
    word-wrap: break-word;
}

.current-operand {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.calculator-buttons,
.scientific-buttons {
    display: grid;
    gap: 1px;
    background: #e0e0e0;
}

.calculator-buttons {
    grid-template-columns: repeat(4, 1fr);
}

.scientific-buttons {
    grid-template-columns: repeat(5, 1fr);
}

.calc-btn {
    background: white;
    border: none;
    padding: clamp(15px, 4vw, 25px);
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.calc-btn:hover {
    background: #f5f5f5;
    transform: scale(1.02);
}

.calc-btn:active {
    transform: scale(0.98);
}

.calc-btn.operator {
    background: #f8f9fa;
    color: #667eea;
    font-weight: 600;
}

.calc-btn.scientific {
    background: #e8f4fd;
    color: #2196f3;
    font-weight: 600;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.calc-btn.memory {
    background: #fff3e0;
    color: #ff9800;
    font-weight: 600;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.calc-btn.equals {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
}

.calc-btn.equals:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
}

/* Investment Calculator Styles */
.investment-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 0 auto;
    max-width: 1000px;
}

.investment-options {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 25px;
    text-align: center;
}

.investment-options h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

.option-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.option-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Interest Type Selection */
.interest-type-selection {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.interest-type-selection h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.interest-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.interest-btn {
    background: white;
    border: 2px solid #e0e0e0;
    color: #666;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 160px;
    justify-content: center;
}

.interest-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.interest-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Input Form Styles */
.input-form {
    padding: 25px;
    background: #f8f9fa;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.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);
}

.form-group input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.term-input {
    display: flex;
    gap: 10px;
}

.term-input input {
    flex: 1;
}

.term-input select {
    width: 100px;
}

.calculate-btn,
.add-investment-btn,
.clear-all-btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
    border: none;
}

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

.calculate-btn:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.add-investment-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.add-investment-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-2px);
}

.clear-all-btn {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    color: white;
}

.clear-all-btn:hover {
    background: linear-gradient(135deg, #c82333, #d63384);
    transform: translateY(-2px);
}

/* Investment List */
.investment-list {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.investment-list h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.investment-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.investment-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.investment-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.investment-info {
    flex: 1;
}

.investment-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.investment-details {
    font-size: 0.85rem;
    color: #666;
}

.remove-investment {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.remove-investment:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* Results Section */
.results-section {
    padding: 25px;
    background: white;
}

.results-section h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
}

.card-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card-content h4 {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 3px;
    font-weight: 500;
}

.card-content p {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

/* Comparison Table */
.comparison-table {
    margin-bottom: 30px;
}

.comparison-table h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f8f9fa;
}

.action-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* Chart Container */
.chart-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.chart-container h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

#investment-chart {
    width: 100%;
    height: 300px;
    background: white;
    border-radius: 8px;
    padding: 15px;
}

/* Responsive Design */
@media (min-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .option-buttons {
        gap: 15px;
    }
    
    .option-btn {
        padding: 15px 25px;
        font-size: 0.9rem;
    }
    
    .interest-buttons {
        gap: 20px;
    }
    
    .interest-btn {
        padding: 15px 25px;
        font-size: 1rem;
    }
    
    .input-form {
        padding: 40px;
    }
    
    .results-section {
        padding: 40px;
    }
    
    .calculator-display {
        padding: 30px;
        min-height: 120px;
    }
    
    .current-operand {
        font-size: 2.5rem;
    }
    
    .calc-btn {
        padding: 25px;
        font-size: 1.2rem;
    }
    
    #investment-chart {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .nav-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .tab-btn {
        width: 100%;
        min-width: auto;
    }
    
    .option-buttons {
        flex-direction: column;
    }
    
    .option-btn {
        width: 100%;
        min-width: auto;
    }
    
    .interest-buttons {
        flex-direction: column;
    }
    
    .interest-btn {
        width: 100%;
        min-width: auto;
    }
    
    .summary-card {
        flex-direction: column;
        text-align: center;
    }
    
    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .card-content p {
        font-size: 1.1rem;
    }
    
    .scientific-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .calc-btn.scientific,
    .calc-btn.memory {
        font-size: 0.7rem;
        padding: 12px 8px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success Animation */
.success-animation {
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* PWA Specific Styles */
.install-prompt-btn,
.update-notification-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.install-prompt-btn:hover,
.update-notification-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.update-notification-btn {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.update-notification-btn:hover {
    background: linear-gradient(135deg, #e0a800, #e8590c);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.pwa-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    max-width: 300px;
    font-size: 0.9rem;
    font-weight: 500;
}

.pwa-notification-success {
    background: #28a745;
    color: white;
}

.pwa-notification-warning {
    background: #ffc107;
    color: #212529;
}

.pwa-notification-info {
    background: #17a2b8;
    color: white;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* PWA splash screen */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
    text-align: center;
}

.pwa-splash.hide {
    animation: fadeOut 0.5s ease forwards;
}

.pwa-splash-icon {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.pwa-splash-icon i {
    font-size: 3rem;
    color: #667eea;
}

.pwa-splash h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.pwa-splash p {
    font-size: 1rem;
    opacity: 0.8;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Responsive PWA elements */
@media (max-width: 768px) {
    .install-prompt-btn,
    .update-notification-btn {
        font-size: 0.7rem;
        padding: 6px 12px;
    }
    
    .pwa-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .pwa-splash-icon {
        width: 80px;
        height: 80px;
    }
    
    .pwa-splash-icon i {
        font-size: 2rem;
    }
    
    .pwa-splash h1 {
        font-size: 1.5rem;
    }
}
