/* Modern Vocabulary Learning Website Styles */

/* CSS Variables for Theme Support */
:root {
    /* Light Mode Colors */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-hover: #e9ecef;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --text-light: #888;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --border-color: #e9ecef;
    --border-input: #ddd;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #c3e6cb;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --error-border: #f5c6cb;
    --info-bg: #d1ecf1;
    --info-text: #0c5460;
    --info-border: #bee5eb;
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --bg-gradient-start: #1a202c;
    --bg-gradient-end: #2d3748;
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-hover: #4a5568;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e0;
    --text-light: #a0aec0;
    --accent-primary: #63b3ed;
    --accent-secondary: #4299e1;
    --border-color: #4a5568;
    --border-input: #718096;
    --shadow-light: rgba(0, 0, 0, 0.4);
    --shadow-medium: rgba(0, 0, 0, 0.6);
    --success-bg: rgba(72, 187, 120, 0.3);
    --success-text: #9ae6b4;
    --success-border: #68d391;
    --error-bg: rgba(245, 101, 101, 0.3);
    --error-text: #feb2b2;
    --error-border: #fc8181;
    --info-bg: rgba(66, 153, 225, 0.3);
    --info-text: #90cdf4;
    --info-border: #63b3ed;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px var(--shadow-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    color: var(--accent-primary);
    font-size: 2rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Dark Mode Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin-right: 10px;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.theme-toggle .icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .icon {
    transform: rotate(180deg);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* Login Form */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 8px 32px var(--shadow-medium);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--accent-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-input);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* Add Word Form */
.add-word-section {
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px var(--shadow-medium);
}

.add-word-section h3 {
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.add-word-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.input-with-pronunciation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-pronunciation .form-control {
    flex: 1;
}

.input-with-pronunciation .btn-pronunciation {
    flex-shrink: 0;
    margin-left: 0;
}

/* Search and Controls */
.controls {
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px var(--shadow-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.sort-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sort-controls select {
    padding: 8px 12px;
    border: 2px solid var(--border-input);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sort-controls .btn {
    white-space: nowrap;
}

/* Vocabulary Table */
.vocab-section {
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px var(--shadow-medium);
}

.vocab-section h3 {
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.vocab-table th,
.vocab-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.vocab-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.vocab-table tbody tr {
    transition: all 0.3s ease;
}

.vocab-table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

.word-cell {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.btn-pronunciation {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px 10px;
    margin-right: 5px;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-pronunciation:hover {
    background: linear-gradient(45deg, #218838, #1ea080);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-pronunciation:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-pronunciation:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: var(--text-light);
}

.meaning-cell {
    max-width: 200px;
    word-wrap: break-word;
}

.translation-cell {
    font-style: italic;
    color: var(--text-muted);
    max-width: 200px;
    word-wrap: break-word;
}

.synonyms-cell {
    font-size: 0.9rem;
    color: var(--text-light);
    max-width: 250px;
    word-wrap: break-word;
}

.actions-cell {
    white-space: nowrap;
    min-width: 140px;
}

.actions-cell .btn {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 5px;
}

.actions-cell .btn-pronunciation {
    padding: 6px 10px;
    font-size: 1rem;
    margin-right: 5px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-primary);
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px var(--shadow-medium);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h4 {
    color: var(--accent-primary);
    margin: 0;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

/* Loading and Messages */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.message {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.message.info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h4 {
    margin-bottom: 10px;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .add-word-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sort-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .sort-controls .btn {
        flex: 1;
        min-width: 120px;
        margin-top: 10px;
    }
    
    .vocab-table {
        font-size: 14px;
    }
    
    .vocab-table th,
    .vocab-table td {
        padding: 8px;
    }
    
    .meaning-cell,
    .translation-cell,
    .synonyms-cell {
        max-width: 150px;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .vocab-table {
        font-size: 12px;
    }
    
    .actions-cell .btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .actions-cell .btn-pronunciation {
        font-size: 0.9rem;
        padding: 4px 8px;
        margin-right: 3px;
    }
    
    .actions-cell {
        min-width: 120px;
    }
    
    .input-with-pronunciation {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    
    .input-with-pronunciation .btn-pronunciation {
        align-self: center;
        margin-top: 5px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Word Type Badge */
.word-type {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 8px;
}

/* Statistics */
.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}
