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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a1a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e0e0e0;
    padding: 20px;
    position: relative;
}

/* Add Word Button */
.top-right-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.add-word-btn,
.word-table-btn {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: #1a1a1a;
    color: #e0e0e0;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.login-btn {
    padding: 10px 20px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6a5acd 0%, #8470ff 100%);
    color: #ffffff;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(106, 90, 205, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 90, 205, 0.5);
    background: linear-gradient(135deg, #7b68ee 0%, #9370db 100%);
}

.login-btn:active {
    transform: translateY(0);
}

.add-word-btn:hover,
.word-table-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.add-word-btn:active,
.word-table-btn:active {
    transform: scale(1.05);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a1a;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: #e0e0e0;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #b0b0b0;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #404040;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: #1a1a1a;
    color: #e0e0e0;
}

.input-group input:focus {
    outline: none;
    border-color: #808080;
}

.btn-ai {
    padding: 10px 20px;
    border: 2px solid #6a5acd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #6a5acd 0%, #9370db 100%);
    color: #fff;
    align-self: flex-start;
}

.btn-ai:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 90, 205, 0.4);
    background: linear-gradient(135deg, #7b68ee 0%, #9370db 100%);
}

.btn-ai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #404040;
    color: #e0e0e0;
}

.btn-primary:hover {
    background: #505050;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(80, 80, 80, 0.4);
}

.btn-secondary {
    background: #1a1a1a;
    color: #b0b0b0;
}

.btn-secondary:hover {
    background: #333333;
}

.loading-translation {
    margin-top: 20px;
    color: #b0b0b0;
    font-weight: 600;
    text-align: center;
}

.loading-translation.hidden {
    display: none;
}

/* PIN Modal Styles */
.pin-modal {
    z-index: 10000;
}

.pin-modal-content {
    max-width: 450px;
    text-align: center;
}

.pin-message {
    color: #b0b0b0;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.pin-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.pin-modal .input-group {
    margin-bottom: 20px;
}

.pin-modal input[type="password"] {
    font-size: 1.1rem;
    letter-spacing: 0.3em;
    text-align: center;
}

@media (max-width: 480px) {
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
    
    .add-word-btn {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
}

.container {
    text-align: center;
    animation: fadeIn 0.5s ease-in;
    width: 100%;
    max-width: 600px;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.word-card {
    background: #1a1a1a;
    padding: 60px 80px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    min-width: 400px;
}

@media (max-width: 768px) {
    .word-card {
        padding: 40px 30px;
        min-width: unset;
        width: 100%;
    }
}

.swedish-word {
    font-size: 4rem;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 20px;
    letter-spacing: -1px;
    cursor: pointer;
    transition: transform 0.2s ease;
    word-wrap: break-word;
    user-select: none;
}

.swedish-word:hover {
    transform: scale(1.05);
}

.swedish-word:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .swedish-word {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .swedish-word {
        font-size: 2rem;
    }
}

.english-translation {
    font-size: 1.5rem;
    color: #b0b0b0;
    margin-bottom: 10px;
    transition: opacity 0.3s ease;
    word-wrap: break-word;
}

.english-translation.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .english-translation {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .english-translation {
        font-size: 1rem;
    }
}

.word-type {
    font-size: 1rem;
    color: #808080;
    font-style: italic;
}

.button-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.speak-btn,
.new-word-btn {
    background: #404040;
    color: #e0e0e0;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.speak-btn:hover,
.new-word-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    background: #505050;
}

.speak-btn:active,
.new-word-btn:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .speak-btn,
    .new-word-btn {
        font-size: 1rem;
        padding: 12px 24px;
    }
    
    .button-container {
        gap: 10px;
    }
}

/* Examples Section */
.examples-section {
    margin-top: 30px;
    width: 100%;
}

.btn {
    background: #404040;
    color: #e0e0e0;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    background: #505050;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: #404040;
}

.examples-container {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin-top: 20px;
    text-align: left;
    animation: fadeIn 0.5s ease-in;
}

.examples-container h3 {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.examples-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.example-item {
    padding: 15px;
    background: #1a1a1a;
    border-radius: 4px;
    border-left: 4px solid #808080;
}

.example-swedish {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 5px;
    font-weight: 500;
}

.example-english {
    font-size: 0.95rem;
    color: #b0b0b0;
    font-style: italic;
}

.loading {
    color: #e0e0e0;
    font-size: 1.1rem;
    margin-top: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .examples-container {
        padding: 20px;
    }
    
    .examples-container h3 {
        font-size: 1.1rem;
    }
    
    .example-swedish {
        font-size: 1rem;
    }
    
    .example-english {
        font-size: 0.9rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 10px 18px;
    }
    
    .button-group {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .btn {
        font-size: 0.85rem;
        padding: 8px 14px;
    }
    
    .button-group {
        gap: 6px;
    }
}

/* Word Table Modal */
.word-table-modal .modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.word-table-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.word-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px 20px;
    border-bottom: 2px solid #404040;
}

.word-table-header h2 {
    margin: 0;
    color: #e0e0e0;
    font-size: 1.8rem;
}

.btn-close {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.btn-close:hover {
    background: #404040;
    transform: scale(1.1);
}

.word-table-controls {
    padding: 20px 40px;
    display: flex;
    gap: 15px;
    align-items: center;
    border-bottom: 2px solid #404040;
    flex-wrap: wrap;
}

.word-table-search {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #404040;
    border-radius: 6px;
    font-size: 1rem;
    background: #1a1a1a;
    color: #e0e0e0;
    transition: border-color 0.3s ease;
}

.word-table-search:focus {
    outline: none;
    border-color: #808080;
}

.btn-toggle-translations {
    padding: 12px 20px;
    border: 2px solid #404040;
    border-radius: 6px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-toggle-translations:hover {
    background: #404040;
    transform: translateY(-2px);
}

.btn-export-words {
    padding: 12px 20px;
    border: 2px solid #404040;
    border-radius: 6px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-export-words:hover {
    background: #404040;
    transform: translateY(-2px);
}

.word-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px 40px;
}

.word-table {
    width: 100%;
    border-collapse: collapse;
}

.word-table thead th {
    position: sticky;
    top: 0;
    background: #1a1a1a;
    color: #b0b0b0;
    font-weight: 600;
    text-align: left;
    padding: 15px 20px;
    border-bottom: 2px solid #404040;
    font-size: 1.1rem;
    z-index: 10;
}

.word-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.word-table thead th.sortable:hover {
    background: #2a2a2a;
    color: #e0e0e0;
}

.word-table-row {
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #2a2a2a;
}

.word-table-row:hover {
    background: #2a2a2a;
}

.word-table td {
    padding: 15px 20px;
    color: #e0e0e0;
}

.word-swedish {
    font-weight: 600;
    font-size: 1.1rem;
}

.word-english {
    color: #b0b0b0;
    font-size: 1rem;
}

.word-actions-header {
    width: 60px;
    text-align: center;
}

.word-actions {
    width: 90px;
    text-align: center;
    padding: 10px !important;
}

.btn-edit-word,
.btn-delete-word {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.btn-edit-word:hover {
    opacity: 1;
    background: rgba(107, 168, 255, 0.2);
    transform: scale(1.1);
}

.btn-delete-word:hover {
    opacity: 1;
    background: rgba(255, 107, 107, 0.2);
    transform: scale(1.1);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #b0b0b0;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .word-table-modal .modal-content {
        width: 98%;
        max-height: 95vh;
    }

    .word-table-header {
        padding: 20px 20px 15px;
    }

    .word-table-header h2 {
        font-size: 1.5rem;
    }

    .word-table-controls {
        padding: 15px 20px;
        flex-direction: column;
        align-items: stretch;
    }

    .word-table-search {
        width: 100%;
    }

    .btn-toggle-translations {
        width: 100%;
    }

    .word-table-container {
        padding: 15px 20px 20px;
    }

    .word-table thead th {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .word-table td {
        padding: 12px 15px;
    }

    .word-swedish {
        font-size: 1rem;
    }

    .word-english {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .word-table-header h2 {
        font-size: 1.3rem;
    }

    .btn-close {
        font-size: 2rem;
        width: 35px;
        height: 35px;
    }

    .word-table thead th,
    .word-table td {
        padding: 10px 12px;
    }

    .word-swedish {
        font-size: 0.95rem;
    }

    .word-english {
        font-size: 0.85rem;
    }
}
