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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.profile-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #667eea;
}

.user-name {
    font-weight: 500;
    color: #333;
    flex-grow: 1;
    text-align: left;
}

.logout-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.login-section {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.login-section p {
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: white;
    color: #333;
    text-decoration: none;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.google-login-btn:hover {
    border-color: #4285F4;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.15);
    transform: translateY(-2px);
}

.google-login-btn:active {
    transform: translateY(0);
}

.date-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.section-title {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.date-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.date-input {
    margin-bottom: 0;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    cursor: pointer;
}

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

select option {
    padding: 10px;
}

input[type="number"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="number"]::placeholder {
    color: #999;
}

.update-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.update-btn:active {
    transform: translateY(0);
}

.update-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result-container {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.result-container h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    text-align: center;
    font-weight: 600;
}

.rates-tables {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rate-table-wrapper {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.table-header {
    padding: 12px 15px;
    margin: 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.sales-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.purchase-header {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
}

.rate-table {
    width: 100%;
    border-collapse: collapse;
}

.rate-table thead {
    background: #f8f9fa;
}

.rate-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 14px;
    border-bottom: 2px solid #e1e5e9;
}

.rate-table th:last-child {
    text-align: right;
}

.rate-table tbody tr {
    transition: background 0.2s ease;
}

.rate-table tbody tr:hover {
    background: #f8f9fa;
}

.rate-table td {
    padding: 12px 15px;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #e1e5e9;
}

.rate-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

.rate-table tbody tr:last-child td {
    border-bottom: none;
}

.error-message {
    margin-top: 20px;
    padding: 15px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    border-left: 4px solid #c33;
    font-size: 14px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 25px;
    }
    
    .date-inputs {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .date-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    input[type="number"],
    select {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .update-btn {
        padding: 12px;
        font-size: 16px;
    }
    
    .result-container h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .rate-table th,
    .rate-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .table-header {
        font-size: 15px;
        padding: 10px 12px;
    }
}

/* Android WebView optimizations */
@media screen and (max-width: 360px) {
    .card {
        padding: 15px;
    }
    
    h1 {
        font-size: 22px;
    }
}

/* Landscape orientation for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
    }
    
    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .input-group {
        margin-bottom: 15px;
    }
    
    .result-container {
        margin-top: 15px;
        padding: 15px;
    }
}
