/* === Global style === */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #e3f2fd, #f6f7fb);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}

/* === Container === */
.container {
    text-align: center;
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    transition: 0.3s ease;
    margin-top: 50px;
    margin-bottom: 70px;
}

/* === Search Bar === */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

select,
input {
    padding: 12px 15px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    outline: none;
    transition: 0.3s;
}

select:focus,
input:focus {
    border-color: #0078ff;
    box-shadow: 0 0 5px rgba(0, 120, 255, 0.3);
}

/* === RESPONSIVE: addModal ichidagi inputlar moslashuvi === */

.modal-add form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* Asosiy input dizayn (desktopda) */
.modal-add input,
.modal-add select,
.modal-add textarea {
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

@media (min-width: 600px) {
    .searchDiv {
        display: flex;
        align-items: center;
    }
}

/* Planshetlar uchun (max 768px) */
@media (max-width: 768px) {
    .modal-add {
        width: 90%;
        padding: 20px;
    }

    .modal-add input,
    .modal-add select,
    .modal-add textarea {
        font-size: 15px;
        padding: 10px 12px;
    }

    .modal-add textarea {
        min-height: 80px;
    }
}

/* Telefonlar uchun (max 480px) */
@media (max-width: 480px) {
    .modal-add {
        width: 95%;
        padding: 18px;
    }

    .modal-add {
        max-width: 300px;
    }

    .modal-add h2 {
        font-size: 18px;
    }

    .modal-add input,
    .modal-add select,
    .modal-add textarea {
        width: 100%;
        font-size: 14px;
        padding: 9px 10px;
    }

    .modal-add textarea {
        min-height: 70px;
    }

    .saveBtn {
        font-size: 14px;
        padding: 10px;
    }
}

input {
    flex: 1;
    min-width: 180px;
}

/* === Button === */
button {
    padding: 12px 25px;
    border: none;
    background: linear-gradient(135deg, #0078ff, #00bfff);
    color: white;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
}

/* === Result Box (modern look) === */
#result {
    display: inline-block;
    background: #ffffff;
    color: #1e1e1e;
    padding: 18px 30px;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    letter-spacing: 0.3px;
    text-align: center;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    max-width: 100%;
    word-wrap: break-word;

    em {
        color: #979797;
    }
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

#wordInput {
    width: 100%;
    padding: 10px 40px 10px 12px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    transition: all 0.2s ease;
}

#wordInput:focus {
    outline: none;
    border-color: #0078ff;
    box-shadow: 0 0 5px rgba(0, 120, 255, 0.3);
}

.search-btn {
    position: absolute;
    right: 5px;
    background: #fff;
    border: 1px solid #0e0e0e;
    color: white;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Mobil uchun moslashuv */
@media (max-width: 600px) {
    .search-bar {
        flex-direction: column;
        gap: 8px;
    }

    .search-btn {
        right: 8px;
    }
}

/* === Table === */
table {
    margin-top: 25px;
    border-collapse: collapse;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
}

th,
td {
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    text-align: left;
}

th {
    background: #0078ff;
    color: white;
}

tr:nth-child(even) {
    background: #f2f8ff;
}

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

.addClose {
    display: flex;
    justify-content: end;
}

.modal-add {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 12px;
    width: 80%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    position: relative;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 24px;
    cursor: pointer;
}


#wordList li {
    background: #eef5ff;
    margin: 5px 0;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

#wordList li:hover {
    background: #dceaff;
}

.searchDiv {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#wordList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 10px;
    transition: all 0.25s ease;
    cursor: pointer;
}


.word-text strong {
    font-size: 17px;
    color: #333;
}

.word-text .type {
    color: #007bff;
    font-size: 14px;
}

.word-text small {
    color: #666;
}

.delete-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s ease;
}

.delete-btn:hover {
    transform: scale(1.2);
    color: red;
}

/* === Mobile responsiveness === */
@media (max-width: 480px) {
    body {
        height: 100%;
    }

    .container {
        padding: 20px;
        margin-top: 0;
    }

    #result {
        font-size: 18px;
        padding: 15px 20px;
    }

    select,
    input {
        width: 100%;
    }

    .btn-group {
        button {
            width: 100%;
        }
    }
}

/* === YANGI SO‘Z QO‘SHISH MODALI === */

#addModal .modal-content {
    background: #ffffff;
    margin: 6% auto;
    padding: 25px 30px;
    border-radius: 14px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
}

#addModal h2 {
    text-align: center;
    color: #0078ff;
    margin-bottom: 20px;
    font-size: 22px;
}

/* Form stili */
#addWordForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#addWordForm label {
    font-weight: 600;
    text-align: left;
    color: #333;
    font-size: 15px;
}


#addWordForm input,
#addWordForm select,
#addWordForm textarea {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ccc;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
    width: 100%;
    resize: none;
}

#addWordForm input:focus,
#addWordForm select:focus,
#addWordForm textarea:focus {
    border-color: #0078ff;
    box-shadow: 0 0 6px rgba(0, 120, 255, 0.3);
}

/* Saqlash tugmasi */
.saveBtn {
    background: #0078ff;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.saveBtn:hover {
    background: #005fcc;
}

/* Yopish belgisi */
.addClose {
    float: right;
    font-size: 26px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: 0.3s;
}

.addClose:hover {
    color: #ff5252;
}

/* === RESPONSIVE QISMI === */
@media (max-width: 768px) {
    #addModal .modal-content {
        width: 90%;
        padding: 20px;
        margin: 15% auto;
    }

    body {
        background: #fff;
    }

    #result {
        max-width: 500px;
        width: 100%;
    }

    .container {
        box-shadow: none;
    }

    h1 {
        font-size: 23px;
    }

    #addModal h2 {
        font-size: 20px;
    }

    #addWordForm label {
        font-size: 14px;
    }

    #addWordForm input,
    #addWordForm select,
    #addWordForm textarea {
        font-size: 15px;
        padding: 10px;
    }

    .saveBtn {
        font-size: 15px;
        padding: 10px;
    }

    .addWordBtn {
        margin-top: 10px;
    }
}

#result {
    display: inline-block;
    padding: 20px 35px;
    border-radius: 15px;
    font-size: 22px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 120, 255, 0.4);
    letter-spacing: 0.5px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 20px;

    /* 🔹 Responsivlik */
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
}

/* 📱 Ekran kichik bo‘lsa */
@media (max-width: 600px) {
    #result {
        font-size: 18px;
        padding: 15px 20px;
        border-radius: 10px;
        width: 100%;
    }
}

/* 📱 Juda kichik (masalan, telefon 350px dan kichik) */
@media (max-width: 400px) {
    #result {
        font-size: 16px;
        padding: 12px 16px;
        width: 98%;
    }
}

/* === Muvaffaqiyatli xabar dizayni === */
.success-message {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #4caf50;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: fadeInOut 3s ease forwards;
}

/* Chiqarilganda yumshoq effekt */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -10px);
    }

    10%,
    90% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
}

/* Telefonlar (max-width: 480px) */
@media (max-width: 480px) {
    #addModal .modal-content {
        width: 95%;
        padding: 18px;
        margin: 20% auto;
    }

    #addModal h2 {
        font-size: 18px;
    }

    #addWordForm label {
        font-size: 13px;
    }

    #addWordForm input,
    #addWordForm select,
    #addWordForm textarea {
        font-size: 14px;
        padding: 9px;
    }

    .saveBtn {
        font-size: 14px;
        padding: 9px;
    }
}

/* Modal chiqish animatsiyasi */
@keyframes fadeIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* 🔹 Modal asosiy */
.modal {
    display: none;
    position: fixed;
    z-index: 20;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

/* 🔹 Modal content */
.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    animation: pop 0.3s ease;
}

@keyframes pop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 🔹 Yangi so‘z qo‘shish form */
.modal-add input,
.modal-add select,
.modal-add textarea {
    width: 100%;
    padding: 10px 12px;
    margin: 8px 0 15px 0;
    border-radius: 8px;
    border: 1px solid #bbb;
    font-size: 16px;
    transition: all 0.2s ease;
}

.modal-add input:focus,
.modal-add select:focus,
.modal-add textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 3px #007bff;
}

.saveBtn {
    width: 100%;
    padding: 10px;
    background: #007bff;
    border: none;
    color: white;
    font-size: 17px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
}

.saveBtn:hover {
    background: #0056b3;
}

/* 🔹 O‘chirish modal */
.confirm {
    text-align: center;
}

.confirm .btns {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.confirm button {
    padding: 8px 18px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.yes {
    background: #dc3545;
    color: white;
}

.no {
    background: #6c757d;
    color: white;
}

/* 🔹 Alert qutisi */
#alertBox {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 500;
    animation: fadeInOut 3s ease;
    z-index: 100;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    10%,
    90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 🔹 Jadval (Lug‘atni ko‘rish) */
#wordList table {
    width: 100%;
    border-collapse: collapse;
}

#wordList th,
#wordList td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
}

.delete-btn:hover {
    transform: scale(1.2);
}

/* 🔹 Responsive */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 20px;
    }

    input,
    select,
    textarea {
        font-size: 15px;
    }

    .saveBtn {
        font-size: 16px;
    }

    .confirm button {
        font-size: 14px;
        padding: 6px 14px;
    }
}

.confirmModal {
    position: relative;
    z-index: 1000;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 🧱 Confirm modalni doim eng oldinga chiqarish uchun */
#confirmModal {
    z-index: 9999 !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

/* Ichidagi oyna (tasdiqlash qutisi) */
#confirmModal .modal-content {
    z-index: 10000;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    animation: popUp 0.25s ease;
}

/* Animatsiya */
@keyframes popUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tugmalar dizayni */
#confirmModal .btns {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

#confirmModal .yes {
    background: #dc3545;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.3s;
}

#confirmModal .no {
    background: #6c757d;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.3s;
}

#confirmModal .yes:hover {
    background: #c82333;
}

#confirmModal .no:hover {
    background: #5a6268;
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background: #f9f9f9;
    color: #333;
    font-size: 10px;
    font-weight: 500;
    padding: 10px 0;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

footer p {
    margin: 0;
}

footer strong {
    color: #0078ff;
}

#relatedWords ul {
    list-style: none;
    padding: 0;
    margin-top: 8px;
}

#relatedWords li {
    display: inline-block;
    background: #e7f0fa;
    color: #007bff;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 6px;
    font-weight: 500;
    transition: 0.3s;
}

#relatedWords li:hover {
    background: #d0e4fb;
    transform: scale(1.05);
}