/* General Body and Container Styling */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column; /* Stacks children vertically */
    justify-content: center; /* Centers content vertically */
    align-items: center; /* Centers content horizontally */
    min-height: 100vh;
    margin: 0;
}

.container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 90%;
    max-width: 1200px;
    text-align: center;
    position: relative;
    margin-bottom: 20px; /* Adds space between the container and the footer links */
}

/* Footer links styling to ensure they are centered and at the bottom */
.footer-links {
    text-align: center;
    margin-top: 20px;
}

.footer-links p {
    margin: 5px 0;
}


/* Header */
.header h1 {
    color: #4CAF50;
    margin-bottom: 5px;
    font-size: 2.5em;
}

.header p {
    color: #666;
    margin-top: 0;
    font-size: 1.1em;
}

/* Configuration Panel */
.config-panel {
    margin-bottom: 20px;
}

.config-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.config-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.config-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.config-group select,
.config-group input,
.config-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    width: 200px;
}

#custom-duration {
    margin-top: 5px;
}

#custom-text {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}

.start-btn {
    padding: 12px 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    background-color: #4CAF50;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.start-btn:hover {
    background-color: #45a049;
}

/* Test Area */
.test-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats-display {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 8px;
    width: 100%;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
}

/* Test Content (Text & Keyboard) */
.test-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
    margin-bottom: 20px;
}

.text-display-container {
    flex: 1;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    line-height: 1.6;
    font-size: 1.2em;
    white-space: pre-wrap;
    background-color: #f9f9f9;
}

.text-display {
    padding: 0;
    margin: 0;
}

.char {
    display: inline-block;
    transition: background-color 0.2s ease;
}

.char.current {
    background-color: #add8e6;
    border-radius: 3px;
}

.char.correct {
    color: #28a745;
}

.char.incorrect {
    color: #dc3545;
    text-decoration: underline;
}

.typing-input {
    width: 95%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #ccc;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    outline: none;
    transition: border-color 0.3s ease;
}

.typing-input:focus {
    border-color: #4CAF50;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.control-btn {
    padding: 10px 20px;
    font-size: 1em;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.control-btn:hover {
    background-color: #0056b3;
}

/* Results Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.result-item {
    background-color: #f0f2f5;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-label {
    font-size: 0.9em;
    color: #666;
}

.result-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #4CAF50;
}

.modal-btn {
    padding: 10px 20px;
    margin: 0 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.modal-btn.primary {
    background-color: #4CAF50;
    color: #fff;
}

.modal-btn.primary:hover {
    background-color: #45a049;
}

/* Keyboard Styling */
.keyboard-container {
    flex: 1;
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 3px;
    width: 100%;
}

.key {
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-weight: bold;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    font-size: 12px; /* Change this value for font size */
}

.key.key-space {
    flex-grow: 1;
}

/* Highlighting the next key to press */
.key.highlight {
    background-color: #4CAF50;
    color: #ffffff;
    box-shadow: 0 0 10px #4CAF50;
    transform: scale(1.1);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .config-row {
        flex-direction: column;
        gap: 1px;
    }
    
    .test-content {
        flex-direction: column;
        gap: 15px;
    }

    .text-display-container {
        height: auto;
    }

    .keyboard-container {
        width: 100%;
    }
    
    .key {
        width: 30px;
        height: 30px;
        font-size: 0.8em;
    }
    
    .stats-display {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stat-item {
        flex-basis: 45%;
    }
}