
:root {
    --primary: #2A5C7D;
    --secondary: #7FB5B5;
    --accent: #FF9478;
    --background: #F9F5F0;
    --text: #2c3e50;
    --container-bg: white;
}

[data-theme="dark"] {
    --primary: #4A8DB7;
    --secondary: #5F9E9E;
    --accent: #FFA78E;
    --background: #1A1A1A;
    --text: #E0E0E0;
    --container-bg: #2D2D2D;
}

body {
    font-family: 'Manrope', sans-serif;
    background: var(--background);
    color: var(--text);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: background 0.3s;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header h1 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 2.5rem;
    margin: 0;
}

.controls {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 10px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 5px;
}

.translator-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    position: relative;
    align-items: stretch; /* Ensure both boxes stretch to the same height */
}

.translation-box {
    position: relative;
    background: var(--container-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px; /* Add spacing between elements */
    height: auto; /* Allow height to adjust dynamically */
}

.input-header {
    text-align: center; /* Center the label */
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: auto; /* Push buttons to the bottom */
}

textarea {
    flex-grow: 1; /* Ensure textareas fill available space */
    width: 100%; /* Ensure full width inside the container */
    height: 100%; /* Match the height of the container */
    padding: 15px;
    border: 2px solid var(--secondary);
    border-radius: 10px;
    resize: none;
    font-size: 16px;
    transition: border-color 0.3s;
    background: var(--container-bg);
    color: var(--text);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
    box-sizing: border-box; /* Include padding and border in width */
}

textarea:focus {
    border-color: var(--primary);
    outline: none;
}

@media (max-width: 768px) {
    .translator-box {
        grid-template-columns: 1fr; /* Stack boxes vertically on smaller screens */
    }

    .button-group {
        justify-content: center; /* Center buttons on smaller screens */
    }

    .theme-toggle {
        font-size: 1.2rem; /* Adjust size for smaller screens */
    }
}

.loading {
    position: relative;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 3px solid var(--primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

.history-panel {
    margin-top: 30px;
    border-top: 2px solid var(--secondary);
    padding-top: 20px;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-controls button {
    margin-right: 10px; /* Add spacing between buttons */
}

.history-controls button:last-child {
    margin-right: 0; /* Remove margin for the last button */
}

.error-message {
    color: #dc3545;
    padding: 10px;
    display: none;
}
.recording {
   color: #ff4444 !important;
   animation: pulse 1s infinite;
}
.pulse {
   animation: pulse 1s infinite;
}

@keyframes pulse {
   0% { transform: scale(1); }
   50% { transform: scale(1.2); }
   100% { transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, opacity 0.2s, background-color 0.3s, box-shadow 0.3s;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
}

.btn-primary:hover {
    background: #1e4a63; /* Slightly darker shade of primary */
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: 2px solid var(--secondary);
}

.btn-secondary:hover {
    background: #6aa3a3; /* Slightly darker shade of secondary */
}

.btn-accent {
    background: var(--accent);
    color: white;
    border: 2px solid var(--accent);
}

.btn-accent:hover {
    background: #e67a5f; /* Slightly darker shade of accent */
}

.btn i {
    font-size: 1.2rem;
}