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

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

.page {
    width: 100%;
    min-height: 100vh;
}

/* Auth Page */
#auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-container h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2rem;
}

.auth-container h2 {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.2rem;
    font-weight: normal;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.auth-tabs button {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tabs button.tab-active {
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form input {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-form button {
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.auth-form button:hover {
    background: #5a6fd8;
}

/* Main Page */
#main-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

.header-content h1 {
    color: #333;
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-weight: 500;
}

.user-info button {
    padding: 8px 15px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.user-info button:hover {
    background: #ff5252;
}

/* Navigation */
nav {
    background: #333;
    padding: 0 20px;
}

nav ul {
    display: flex;
    list-style: none;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-btn {
    padding: 15px 20px;
    background: none;
    border: none;
    color: #ddd;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    color: white;
    background: #667eea;
}

/* Default styles for desktop */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .auth-container {
        padding: 30px 20px;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        gap: 15px;
        text-align: left;
        padding: 10px 0;
    }
    
    .header-content h1 {
        font-size: 1.3rem;
        margin: 0;
    }
    
    .user-info {
        gap: 8px;
    }
    
    .user-info span {
        font-size: 0.9rem;
    }
    
    .user-info button {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* Hide default navigation on mobile */
    nav {
        display: none;
    }
    
    /* Fixed bottom navigation for mobile */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #333;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-nav-btn {
        flex: 1;
        height: 100%;
        background: none;
        border: none;
        color: #ddd;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 0.8rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-btn.active {
        color: white;
        background: #667eea;
    }
    
    .mobile-nav-btn i {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    /* Add bottom padding to main content to prevent overlap */
    main {
        padding-bottom: 60px;
    }
    
    nav ul {
        flex-direction: column;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
    
    .lookup-form {
        flex-direction: column;
    }
    
    .words-actions {
        flex-direction: column;
    }
    
    .import-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .practice-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .practice-controls button {
        width: 100%;
        max-width: 300px;
    }
    
    #words-table {
        font-size: 0.9rem;
    }
    
    #words-table th,
    #words-table td {
        padding: 8px 10px;
    }
}

/* Main Content */
main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.content-section {
    max-width: 1200px;
    margin: 0 auto;
}

/* Lookup Section */
.lookup-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    font-size: 1.2em;
}

.lookup-container h2 {
    margin-bottom: 20px;
    color: #333;
}

.lookup-form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.lookup-form input {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.lookup-form input:focus {
    outline: none;
    border-color: #667eea;
}

.lookup-form button {
    padding: 15px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.lookup-form button:hover {
    background: #5a6fd8;
}

/* Word Details Common Styles */
.word-details {
    margin-top: 15px;
}

.word-details .word {
    font-size: 2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.word-details .phonetics {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.word-details .phonetic-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.word-details .phonetic-label {
    font-weight: bold;
    color: #666;
}

.word-details .phonetic {
    font-style: italic;
    color: #666;
}

.word-details .audio-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #007bff;
    font-size: 0.9em;
    padding: 2px 5px;
    border-radius: 3px;
}

.word-details .audio-btn:hover {
    background-color: #e9ecef;
}

.word-details .word-parts {
    margin: 20px 0;
    text-align: left;
}

.word-details .part {
    margin-bottom: 15px;
}

.word-details .part-name {
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.word-details .part-means {
    margin-left: 10px;
}

.word-details .mean-item {
    margin-bottom: 3px;
    position: relative;
    padding-left: 15px;
}

.word-details .mean-item:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #666;
}

.word-details .word-meaning {
    font-size: 1.1em;
    color: #333;
    margin: 15px 0;
}

.word-details .word-exchange {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: left;
}

.word-details .word-exchange h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
    text-align: left;
}

.word-details .exchange-item {
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
    margin: 5px;
    font-size: 0.9em;
}

/* Translation Result Styles */
.translation-result {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    min-height: 100px;
}

/* Practice Word Styles */
.practice-word {
    font-size: 2em;
    text-align: center;
    margin: 30px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 10px;
}

.word-meaning {
    font-size: 1.2em;
    text-align: center;
    margin: 20px 0;
    min-height: 50px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 10px;
}

/* Words Section */
.words-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.words-container h2 {
    margin-bottom: 20px;
    color: #333;
}

.words-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.words-actions button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.words-actions button:hover {
    background: #5a6fd8;
}

.import-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
    align-items: center;
}

.import-form input {
    flex: 1;
}

.import-form button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#import-btn {
    background: #28a745;
    color: white;
}

#import-btn:hover {
    background: #218838;
}

#confirm-import-btn {
    background: #667eea;
    color: white;
}

#confirm-import-btn:hover {
    background: #5a6fd8;
}

#cancel-import-btn {
    background: #6c757d;
    color: white;
}

#cancel-import-btn:hover {
    background: #5a6268;
}

.words-list-container {
    overflow-x: auto;
}

#words-table {
    width: 100%;
    border-collapse: collapse;
}

#words-table th,
#words-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#words-table th {
    background: #f8f9fa;
    font-weight: 600;
}

#words-table tbody tr:hover {
    background: #f5f5f5;
}

.proficiency-1 { color: #ff4757; }
.proficiency-2 { color: #ffa502; }
.proficiency-3 { color: #3742fa; }
.proficiency-4 { color: #2ed573; }
.proficiency-5 { color: #1e90ff; }

.word-actions {
    display: flex;
    gap: 5px;
}

.word-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
}

.edit-btn {
    background: #667eea;
    color: white;
}

.edit-btn:hover {
    background: #5a6fd8;
}

.delete-btn {
    background: #ff4757;
    color: white;
}

.delete-btn:hover {
    background: #ff2e43;
}

/* Practice Section */
.practice-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.practice-word {
    font-size: 2em;
    text-align: center;
    margin: 30px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 10px;
}

.word-meaning {
    font-size: 1.2em;
    text-align: center;
    margin: 20px 0;
    min-height: 50px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 10px;
}

.practice-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.practice-controls button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: background 0.3s;
}

.practice-controls button:hover {
    background: #5a6fd8;
}

.practice-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.practice-btn {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: background 0.3s;
}

.practice-btn:hover {
    background: #5a6fd8;
}

.practice-btn.secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.practice-btn.secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Practice Settings */
.practice-settings {
    margin-bottom: 20px;
}

.settings-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.settings-form label {
    font-weight: bold;
}

.settings-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.settings-form button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: background 0.3s;
}

.settings-form button:hover {
    background: #5a6fd8;
}

/* Progress Bar */
.practice-progress {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
}

/* Custom Dialog Styles */
#custom-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    max-width: 500px;
    text-align: center;
}

.dialog-content h3 {
    margin-top: 0;
    color: #333;
}

.dialog-body {
    margin: 20px 0;
    color: #666;
}

.dialog-body .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.dialog-body .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.dialog-body .form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.dialog-body .form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.dialog-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dialog-footer button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.dialog-footer #dialog-cancel {
    background-color: #6c757d;
    color: white;
}

.dialog-footer #dialog-cancel:hover {
    background-color: #5a6268;
}

.dialog-footer #dialog-confirm {
    background-color: #667eea;
    color: white;
}

.dialog-footer #dialog-confirm:hover {
    background-color: #5a6fd8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        padding: 30px 20px;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        gap: 15px;
        text-align: left;
        padding: 10px 0;
    }
    
    .header-content h1 {
        font-size: 1.3rem;
        margin: 0;
    }
    
    .user-info {
        gap: 8px;
    }
    
    .user-info span {
        font-size: 0.9rem;
    }
    
    .user-info button {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* Hide default navigation on mobile */
    nav {
        display: none;
    }
    
    /* Fixed bottom navigation for mobile */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #333;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-nav-btn {
        flex: 1;
        height: 100%;
        background: none;
        border: none;
        color: #ddd;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 0.8rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-btn.active {
        color: white;
        background: #667eea;
    }
    
    .mobile-nav-btn i {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    
    /* Add bottom padding to main content to prevent overlap */
    main {
        padding-bottom: 60px;
    }
    
    nav ul {
        flex-direction: column;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
    
    .lookup-form {
        flex-direction: column;
    }
    
    .words-actions {
        flex-direction: column;
    }
    
    .import-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .practice-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .practice-controls button {
        width: 100%;
        max-width: 300px;
    }
    
    #words-table {
        font-size: 0.9rem;
    }
    
    #words-table th,
    #words-table td {
        padding: 8px 10px;
    }
}

.word-exchange {
    margin-top: 20px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 5px;
}

.word-exchange h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.exchange-item {
    display: flex;
    margin-bottom: 8px;
}

.exchange-item:last-child {
    margin-bottom: 0;
}

.exchange-label {
    font-weight: bold;
    color: #667eea;
    min-width: 100px;
}

.exchange-value {
    color: #444;
}
