/* CSS Variables for Theme Colors */
:root {
    --bg-color-light: #e0e5ec;
    --bg-color-dark: #2a2a2a;
    --text-color-light: #333;
    --text-color-dark: #e0e5ec;
    --primary-color-light: #007bff;
    --primary-color-dark: #00aaff;
    --shadow-light-light: rgba(255, 255, 255, 0.7);
    --shadow-dark-light: rgba(0, 0, 0, 0.2);
    --shadow-light-dark: rgba(255, 255, 255, 0.1);
    --shadow-dark-dark: rgba(0, 0, 0, 0.5);
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-color: var(--bg-color-light);
    --text-color: var(--text-color-light);
    --primary-color: var(--primary-color-light);
    --shadow-light: var(--shadow-light-light);
    --shadow-dark: var(--shadow-dark-light);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-color: var(--bg-color-dark);
    --text-color: var(--text-color-dark);
    --primary-color: var(--primary-color-dark);
    --shadow-light: var(--shadow-light-dark);
    --shadow-dark: var(--shadow-dark-dark);
}

/* Base Styles */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Montserrat', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
    padding: 2rem;
}

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

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
}

.controls {
    display: flex;
    gap: 1rem;
}

/* Neomorphic Component Styles */
.card,
.control-btn,
.search-bar input {
    background-color: var(--bg-color);
    border-radius: 20px;
    box-shadow:
        -7px -7px 20px var(--shadow-light),
        7px 7px 20px var(--shadow-dark);
    transition: all 0.3s ease;
}

.card {
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.control-btn {
    border: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-color);
}

.control-btn:hover {
    box-shadow:
        inset -5px -5px 10px var(--shadow-light),
        inset 5px 5px 10px var(--shadow-dark);
}

/* Search Component Styles */
.search-area {
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.search-bar input {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 0 1.5rem;
    height: 50px;
    font-size: 1rem;
    box-shadow:
        inset -5px -5px 10px var(--shadow-light),
        inset 5px 5px 10px var(--shadow-dark);
}

.search-icon-btn {
    margin-left: 0.5rem;
}

.speech-btn.listening i {
    color: var(--primary-color);
}

/* Results Display Styles */
.result-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-card h3 {
    margin: 0;
    font-size: 1.8rem;
}

.result-card .phonetic {
    color: var(--primary-color);
}

.part-of-speech {
    margin-top: 1.5rem;
    border-top: 1px solid var(--text-color);
    padding-top: 1.5rem;
}

.part-of-speech h4 {
    font-style: italic;
    color: var(--primary-color);
}

.definition-item {
    margin-bottom: 1rem;
}

.definition-item .example {
    font-style: italic;
    color: #888;
    margin-left: 1rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: var(--bg-color);
    margin: 15% auto;
    padding: 20px;
    border-radius: 20px;
    width: 80%;
    max-width: 500px;
    box-shadow:
        -7px -7px 20px var(--shadow-light),
        7px 7px 20px var(--shadow-dark);
}

.close-btn {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content ul {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
    margin-bottom: 1rem;
    border-radius: 15px;
    box-shadow:
        inset -5px -5px 10px var(--shadow-light),
        inset 5px 5px 10px var(--shadow-dark);
}

.modal-content ul li {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.modal-content ul li:last-child {
    border-bottom: none;
}

.modal-content ul li:hover {
    color: var(--primary-color);
}

[data-theme="dark"] .modal-content ul li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Clear Button Styles */
.clear-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 12px 20px;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #e74c3c;
    color: #ffffff;
    box-shadow:
        -5px -5px 15px var(--shadow-light),
        5px 5px 15px var(--shadow-dark);
}

.clear-btn:hover {
    background-color: #c0392b;
    box-shadow:
        -3px -3px 10px var(--shadow-light),
        3px 3px 10px var(--shadow-dark);
}

.clear-btn:active {
    background-color: #c0392b;
    color: #f0f0f0;
    box-shadow:
        inset -5px -5px 15px var(--shadow-light),
        inset 5px 5px 15px var(--shadow-dark);
}

/* Responsive Design */

/* Tablet and smaller devices */
@media (max-width: 768px) {
    body {
        padding: 1.5rem;
    }

    .header {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        text-align: center;
    }

    .app-title {
        font-size: 1.8rem;
    }

    .result-card h3 {
        font-size: 1.5rem;
    }

    .modal-content {
        width: 90%;
        margin: 20% auto;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .header .controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }

    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .search-bar {
        padding: 0.4rem;
    }

    .search-bar input {
        padding: 0 1rem;
        height: 48px;
    }

    .card {
        padding: 1rem;
    }

    .result-card h3 {
        font-size: 1.3rem;
    }

    .result-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .result-card .card-header .controls {
        align-self: flex-end;
    }

    .part-of-speech h4 {
        font-size: 1.1rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 15% auto;
    }
}