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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: white;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: #333;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: none;
}

header p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stock-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border: 1px solid #f0f0f0;
}

.form-group {
    margin-bottom: 20px;
    /* Prevent iOS date input overflow */
    min-width: 0;
    overflow: hidden;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    /* Ensure date inputs don't overflow on iOS */
    min-width: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

input[type="text"],
input[type="date"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    /* Fix iOS date input overflow */
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

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

input[type="text"] {
    text-transform: uppercase;
}

small {
    color: #666;
    font-size: 0.875rem;
    margin-top: 5px;
    display: block;
}

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

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

.calculate-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #f0f0f0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.error-message {
    background: #fff5f5;
    color: #e53e3e;
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #e53e3e;
    margin-bottom: 20px;
}

.results {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.results h2 {
    background: #667eea;
    color: white;
    padding: 20px;
    margin: 0;
}

.result-card {
    padding: 30px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-header h3 {
    font-size: 1.5rem;
    color: #333;
}

.result-header span {
    color: #666;
    font-size: 0.9rem;
}

.average-price {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
}

.average-price .label {
    display: block;
    color: #666;
    margin-bottom: 5px;
}

.price {
    font-size: 2rem;
    font-weight: bold;
    color: #2d5016;
}

.result-details {
    color: #666;
    text-align: center;
}

.price-chart {
    border-top: 1px solid #eee;
    padding: 20px 30px;
}

.price-chart h4 {
    margin-bottom: 15px;
    color: #333;
}

.price-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid #f5f5f5;
}

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

.price-item:nth-child(even) {
    background: #f9f9f9;
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: #666;
    opacity: 0.8;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Focus styles for better accessibility */
a:focus,
input:focus,
button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .stock-form {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .price {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .stock-form,
    .result-card,
    .price-chart {
        padding: 15px;
    }
} 