:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --primary-color: #ffffff;
    --text-color: #999999;
    --accent-color: #007bff;
    --border-color: #2a2a2a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-color);
    padding: 15px;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 80px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 10px;
}

.logo-title {
    color: var(--primary-color);
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 5px;
}

header p {
    color: var(--text-color);
    font-size: 13px;
}

.search-box {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s;
    background-color: var(--card-bg);
    color: var(--primary-color);
}

.search-box::placeholder {
    color: #666;
}

.search-box:focus {
    border-color: var(--accent-color);
}

.key-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.key-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.key-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.key-image {
    width: 100%;
    height: 110px;
    object-fit: cover;
    background-color: #181818;
}

.key-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.key-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.key-details {
    font-size: 12px;
    color: var(--text-color);
}

.key-badge {
    display: inline-block;
    background-color: rgba(0, 123, 255, 0.15);
    color: #3b9eff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    align-self: flex-start;
    margin-top: 3px;
}

.no-result {
    text-align: center;
    color: #ff4d4d; /* Qırmızı rəng */
    grid-column: 1 / -1;
    padding: 30px;
    font-size: 14px;
    font-weight: bold; /* İstəyə bağlı olaraq yazını daha səliqəli göstərir */
}

.fab-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 100;
}

.fab-btn:active {
    transform: scale(0.9);
}

.modal-overlay {
    position: fixed;
    top: 0px;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

/* JavaScript vasitəsilə klaviatura açıldıqda aktivləşir */
.modal-overlay.keyboard-open {
    align-items: flex-start !important;
    padding-top: 15px;
}

.modal-content {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 400px;
    max-height: 85dvh;
    padding: 15px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    margin: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
}

#addKeyForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#addKeyForm input, #addKeyForm textarea {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--primary-color);
    font-size: 15px;
    outline: none;
    resize: none;
    transition: border-color 0.3s;
}

#addKeyForm input:focus, #addKeyForm textarea:focus {
    border-color: var(--accent-color);
}

.image-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.image-input-group input[type="url"] {
    flex: 1;
}

.file-upload-btn {
    background-color: #2a2a2a;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.file-upload-btn:hover {
    background-color: #3a3a3a;
}

.large-note-input {
    width: 100%;
    min-height: 150px;
    background-color: #1a1a1a;
    color: #ffffff;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    resize: vertical;
    box-sizing: border-box;
}

.large-note-input:focus {
    border-color: #555555;
    outline: none;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.btn-save, .btn-edit, .btn-delete {
    flex: 1;
    padding: 10px 6px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
}

.btn-save {
    background-color: var(--accent-color);
    color: white;
}

.btn-edit {
    background-color: #ff6a00;
    color: #fff;
}

.btn-delete {
    background-color: #4c66fd;
    color: white;
}

.detail-content {
    text-align: center;
}

.detail-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: #121212;
    border-radius: 8px;
    margin-bottom: 12px;
}

.detail-info-box {
    background-color: #121212;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.detail-info-box span {
    color: var(--primary-color);
}

.detail-note-box {
    background-color: #121212;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 123, 255, 0.4);
    margin-bottom: 12px;
    text-align: left;
}

.note-label {
    font-size: 12px;
    font-weight: bold;
    color: #3b9eff;
    margin-bottom: 2px;
}

#detailNote {
    font-size: 13px;
    color: var(--primary-color);
    word-break: break-word;
    white-space: pre-wrap;
}

.fade-arc-spinner {
    width: 40px;
    height: 40px;
    animation: fade-arc-spin 1s linear infinite;
    margin: 100px auto; /* Yuxarıdan və aşağıdan məsafəni artıraraq mərkəzə salır */
    display: block;
    grid-column: 1 / -1;
    color: var(--primary-color, #fff);
}

@keyframes fade-arc-spin {
    to {
        transform: rotate(360deg);
    }
}

.detail-image {
    cursor: pointer;
    transition: opacity 0.2s;
}

.detail-image:hover {
    opacity: 0.9;
}

.image-modal-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 95% !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

#fullImage {
    width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.brand-input-container {
    position: relative;
    width: 100%;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 0 0 8px 8px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 99;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.suggestion-item {
    padding: 10px 15px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.active {
    background-color: #2c2c2c;
    color: #ffc107;
}

#toastContainer {
    position: fixed;
    top: 20px; /* Aşağıdan yuxarıya daşındı */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast-message {
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-20px); /* Yuxarıdan gəlməsi üçün */
    pointer-events: none;
    border: none;
    text-align: center;
}

.toast-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Uğurlu əməliyyatlar üçün dolu yaşıl rəng */
.toast-message.success {
    background-color: #2e7d32 !important; 
    color: #ffffff !important;
}

/* Xəta və səhvlər üçün dolu qırmızı rəng */
.toast-message.error {
    background-color: #d32f2f !important; 
    color: #ffffff !important;
}

.note-edit-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, border-color 0.2s;
}

.note-edit-icon:hover {
    background-color: #333;
    border-color: #666;
}

.large-note-input::-webkit-resizer {
    background-color: #444;
    border-radius: 4px;
    width: 16px;
    height: 16px;
}

/* Yüklənmə (loading) düymə effekti */
.btn-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.brand-filter-container {
    padding: 0;
    margin-bottom: 15px;
}

.brand-filter-btn {
    width: 60%;
    margin: 0 auto; /* Bu sətir elementi sağdan və soldan avtomatik mərkəzə salacaq */
    padding: 12px 15px;
    background-color: #2a2a2a;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: border-color 0.3s, background-color 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brand-filter-btn:hover {
    border-color: var(--accent-color);
    background-color: #252525;
}

.select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color, #fff);
    pointer-events: none;
    font-size: 11px;
}

/* Seçilmiş markanın kənarlığını göy edən klass */
.brand-item-btn.selected {
    border: 2px solid #3b82f6 !important; /* Göy kənarlıq */
    color: #3b82f6; /* İstəyə görə mətn rəngini də göy edə bilərsiniz */
}

#addBrandForm {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
}

#addBrandForm input {
    flex: 1;
    height: 45px;
    padding: 0 5px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--primary-color);
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

#addBrandForm input:focus {
    border-color: var(--accent-color);
}

#addBrandForm button {
    height: 45px;
    padding: 0 10px;
    white-space: nowrap;
    font-size: 14px;
    flex-shrink: 0;
}

#brandAddModal .modal-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#existingBrandsList {
    max-height: 250px !important;
}

#brandAddModal .modal-content, #editBrandModal .modal-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

textarea {
    resize: vertical; /* Yalnız şaquli istiqamətdə böyüməyə icazə verir */
    min-height: 120px; /* Başlanğıc hündürlüyünü bir az da artırır ki, əvvəlcədən böyük olsun */
}


.detail-info-box {
    display: flex;
    flex-direction: row; /* Yan-yana məcburi düzülüş */
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 15px 0;
    width: 100%;
}

.detail-badge-box {
    background-color: var(--card-bg, #1e1e1e);
    border: 1px solid var(--border-color, #2a2a2a);
    padding: 8px 4px;
    border-radius: 8px;
    text-align: center;
    flex: 1; /* Hər üç qutu bərabər eni paylaşacaq */
    min-width: 0; /* İçindəki mətn daşmasın deyə */
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-label {
    font-size: 11px;
    color: var(--text-color, #999);
    text-transform: uppercase;
    font-weight: 600;
}

.detail-badge-box span:not(.detail-label) {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-color, #fff);
}