* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
}

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

header {
    text-align: center;
    margin-bottom: 25px;
    color: white;
    padding: 10px 0;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    line-height: 1.2;
}

header p {
    font-size: 0.95rem;
    opacity: 0.9;
    padding: 0 10px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calculator-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    margin-bottom: 10px;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.input-group select,
.input-group input {
    width: 100%;
    padding: 14px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
    background: white;
}

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

.calculate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.calculate-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.results-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.results-section h2 {
    margin-bottom: 18px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 8px;
    font-size: 1.3rem;
}

.breakdown-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 25px;
}

.payment-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 14px;
    border-radius: 8px;
    align-items: center;
    font-size: 15px;
}

.coin-item {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-left: 4px solid #e17055;
}

.banknote-item {
    background: linear-gradient(135deg, #a8e6cf, #88d8c0);
    border-left: 4px solid #00b894;
}

.denomination {
    font-weight: 600;
    font-size: 16px;
}

.count {
    color: #666;
    font-weight: 500;
}

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

.summary-stats {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 18px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    font-size: 14px;
}

.stat-item:not(:last-child) {
    border-bottom: 1px solid #e1e1e1;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.stat-item.coins .stat-value {
    color: #e17055;
}

.stat-item.banknotes .stat-value {
    color: #00b894;
}

.stat-item.remaining .stat-value {
    color: #fdcb6e;
}

.efficiency-tip {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 14px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

.wallet-section {
    margin-bottom: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
}

.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
}

.wallet-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.toggle-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-btn:active {
    background: #5a6fd8;
}

.wallet-inputs {
    padding: 16px;
}

.wallet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.wallet-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wallet-item label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    text-align: center;
}

.wallet-item.coin label {
    color: #8b4513;
}

.wallet-item.banknote label {
    color: #00695c;
}

.wallet-input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    width: 100%;
}

.wallet-input:focus {
    outline: none;
    border-color: #667eea;
}

.wallet-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.secondary-btn {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.secondary-btn:active {
    background: #5a6268;
}

.primary-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:active {
    background: #218838;
}

.wallet-status {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    border-left: 4px solid #667eea;
}

.transaction-actions {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e1e1e1;
    margin-top: 16px;
}

.confirm-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.confirm-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.currency-info {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.currency-info h3 {
    margin-bottom: 18px;
    color: #333;
    text-align: center;
    font-size: 1.2rem;
}

.denom-section {
    margin-bottom: 20px;
}

.denom-section h4 {
    margin-bottom: 12px;
    color: #555;
    font-size: 1rem;
}

.denom-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.denom-item {
    padding: 8px 12px;
    border-radius: 16px;
    font-weight: 500;
    font-size: 13px;
    text-align: center;
}

.denom-item.coin {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    color: #8b4513;
}

.denom-item.banknote {
    background: linear-gradient(135deg, #a8e6cf, #88d8c0);
    color: #00695c;
}

@media (min-width: 768px) {
    .container {
        max-width: 1200px;
        padding: 30px;
    }
    
    header {
        margin-bottom: 40px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    header p {
        font-size: 1.1rem;
    }
    
    main {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        align-items: start;
    }
    
    .calculator-section,
    .results-section {
        padding: 30px;
    }
    
    .currency-info {
        grid-column: 1 / -1;
        padding: 30px;
    }
    
    .payment-item {
        font-size: 16px;
    }
    
    .denom-list {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .wallet-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .wallet-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .wallet-header {
        padding: 10px 12px;
    }
    
    .wallet-inputs {
        padding: 12px;
    }
}

@media (max-width: 320px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .calculator-section,
    .results-section,
    .currency-info {
        padding: 15px;
    }
    
    .payment-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 8px;
        padding: 12px;
    }
    
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .wallet-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wallet-header h3 {
        font-size: 0.9rem;
    }
    
    .toggle-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}