/* Percentage Calculator - Light Theme */

/* Mode Selection */

/* Dark mode overrides */
[data-theme="dark"] {
    --tool-bg: #0f172a;
    --tool-border: #334155;
    --tool-border-hover: #475569;
    --tool-text: #f8fafc;
    --tool-text-secondary: #94a3b8;
    --tool-input-bg: #1e293b;
    --tool-input-border: #334155;
    --tool-button-bg: #1e293b;
    --tool-button-hover: #334155;
    --tool-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --tool-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --background-color: #0f172a;
    --text-color: #f8fafc;
    --status-info: rgba(96, 165, 250, 0.2);
    --status-success: rgba(34, 197, 94, 0.2);
    --status-error: rgba(248, 113, 113, 0.2);
    --bg-color: #0f172a;
}

/* Dark mode element overrides */
[data-theme="dark"] .tool-card {
    background: var(--bg-card, #1e293b);
    border-color: var(--border-color, #334155);
}

[data-theme="dark"] .tool-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--input-bg, #1e293b);
    color: var(--text-primary, #f8fafc);
    border-color: var(--border-color, #334155);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted, #64748b);
}

[data-theme="dark"] .tab-btn.active {
    color: white;
}

[data-theme="dark"] label {
    color: var(--text-primary, #f8fafc);
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: var(--text-primary, #f8fafc);
}

[data-theme="dark"] p {
    color: var(--text-secondary, #cbd5e1);
}
.mode-selection {
    margin-bottom: 3rem;
}

.mode-selection h2 {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.mode-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    transition: left 0.5s ease;
}

.mode-card:hover::before {
    left: 100%;
}

.mode-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.mode-card.active {
    border-color: var(--primary-color);
    background: var(--primary-color-alpha);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2);
}

.mode-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.mode-card h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.mode-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.mode-example {
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Calculator Section */
.calculator-section {
    margin-bottom: 3rem;
}

.calc-form {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.calc-form.active {
    display: block;
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.form-row label {
    color: var(--text-color);
    font-weight: 500;
    var(--bg-primary)-space: nowrap;
}

.form-row input {
    width: 120px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-color);
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s;
}

.form-row input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-row input:invalid {
    border-color: #ef4444;
}

/* Result Display */
.result-display {
    min-height: 120px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-main {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.result-explanation {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.result-breakdown {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-color);
    text-align: left;
    max-width: 300px;
}

.result-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Common Calculations */
.common-calculations {
    margin-bottom: 3rem;
}

.common-calculations h3 {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.common-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.common-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.common-card h4 {
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* Tip Calculator */
.tip-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tip-input label {
    color: var(--text-color);
    font-weight: 500;
}

.tip-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-color);
}

.tip-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tip-btn {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.tip-btn:hover {
    background: var(--primary-color);
    color: var(--bg-primary);
    border-color: var(--primary-color);
}

.tip-btn.active {
    background: var(--primary-color);
    color: var(--bg-primary);
    border-color: var(--primary-color);
}

.tip-result {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.tip-amount {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.tip-total {
    color: var(--text-color);
    font-weight: 500;
}

/* Discount Calculator */
.discount-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.discount-input label {
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: block;
}

.discount-input input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-color);
}

.discount-result {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.discount-amount {
    font-size: 1.1rem;
    color: #ef4444;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.discount-final {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* Tax Calculator */
.tax-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tax-input label {
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: block;
}

.tax-input input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-color);
}

.tax-result {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.tax-amount {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tax-total {
    font-size: 1.2rem;
    color: var(--text-color);
    font-weight: 700;
}

/* Calculation History */
.calculation-history {
    margin-bottom: 2rem;
}

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

.history-header h3 {
    color: var(--text-color);
}

.clear-history-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #ef4444;
    color: var(--bg-primary);
    border-color: #ef4444;
}

.history-list {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.history-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.history-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: var(--hover-bg);
}

.history-calculation {
    color: var(--text-color);
    font-weight: 500;
}

.history-result {
    color: var(--primary-color);
    font-weight: 600;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Formula List */
.formula-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.formula-item {
    background: var(--hover-bg);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-color);
}

/* Reference List */
.reference-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reference-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--hover-bg);
    border-radius: 6px;
    font-size: 0.85rem;
}

.ref-percent {
    color: var(--primary-color);
    font-weight: 600;
}

.ref-decimal {
    color: var(--text-color);
}

.ref-fraction {
    color: var(--text-muted);
}

/* Animations */
@keyframes resultAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-display:not(.result-empty) {
    animation: resultAppear 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mode-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-row input {
        width: 200px;
    }
    
    .common-grid {
        grid-template-columns: 1fr;
    }
    
    .discount-input,
    .tax-input {
        grid-template-columns: 1fr;
    }
    
    .tip-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .result-main {
        font-size: 2rem;
    }
    
    .form-row input {
        width: 150px;
    }
    
    .mode-grid {
        gap: 1rem;
    }
    
    .mode-card {
        padding: 1rem;
    }
}


