/* Kartın genel konteyneri */
.agl-card-container {
    margin: 10px 0;
    border: 2px dashed #c5c5c5;
    border-radius: 5px;
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* DÜZELTME: Yazı alanı artık ikonu da içerecek */
.agl-info-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* DÜZELTME: Yeni eklenen Dashicon için stil */
.agl-info-area .dashicons.dashicons-format-gallery {
    font-size: 2.2em;
    color: #6d6d6d;
    line-height: 1; /* Hizalama için */
    height: auto;
    width: auto;
}

.agl-info-area .agl-info-title {
    margin: 0;
    font-size: 1em;
    font-weight: 400;
    color: #6d6d6d;
}

.agl-library-button-wrapper a.agl-open-library-btn {
    text-decoration: none !important;
    box-shadow: none !important;
    padding: 8px 10px;
    font-size: 0.95em;
    font-weight: 600;
    color: #fff !important;
    background-color: #0073aa;
    border: 1px solid #006799;
    border-radius: 3px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.agl-library-button-wrapper a.agl-open-library-btn:hover {
    background-color: #006799;
}

/* Modal Overlay */
.agl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 99998;
    display: none;
    justify-content: center;
    align-items: center;
}

/* Modal Container */
.agl-modal-container {
    background: #fff;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modal Header */
.agl-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7f7f7;
    flex-shrink: 0;
}

.agl-modal-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.agl-modal-close {
    font-size: 1.8em;
    cursor: pointer;
    line-height: 1;
    border: none;
    background: transparent;
    color: #666;
}

/* Modal Body */
.agl-modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Filtreler (arama ve kategoriler) için konteyner */
.agl-modal-filters {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.agl-search-bar input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

/* Yüzen kategori tasarımı */
.agl-categories h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agl-categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agl-categories li {
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 20px;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.9em;
    background-color: #f0f0f0;
    border: 1px solid #e0e0e0;
    color: #444;
}

.agl-categories li:hover {
    background: #e9e9e9;
    border-color: #d0d0d0;
}

.agl-categories li.active {
    background: #007cba;
    color: #fff;
    font-weight: bold;
    border-color: #006ba1;
}

/* Main Content (Image Grid) */
.agl-modal-content {
    padding: 0;
}

.agl-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.agl-image-item {
    position: relative;
    cursor: pointer;
    border: 3px solid #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
    aspect-ratio: 1 / 1;
    background-image:
        linear-gradient(45deg, #eee 25%, transparent 25%),
        linear-gradient(-45deg, #eee 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eee 75%),
        linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.agl-image-item.agl-item-disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.agl-image-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.agl-image-item.selected {
    border-color: #007cba;
}

.agl-image-item.selected:not(.agl-item-disabled)::after {
    content: '✔';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #007cba;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.agl-loading,
.agl-no-results {
    width: 100%;
    text-align: center;
    font-size: 1.2em;
    color: #888;
    padding: 40px 0;
}

/* Modal Footer */
.agl-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    text-align: right;
    background: #f7f7f7;
    flex-shrink: 0;
}

.agl-modal-footer button {
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

.agl-add-btn {
    background: #28a745;
    color: white;
    border: 1px solid #1e7e34;
}

.agl-modal-cancel {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

.agl-add-btn:disabled {
    background: #aaa;
    border-color: #999;
    cursor: not-allowed;
}

/* DÜZELTME: Masaüstü için font büyütme ve mobil için ikon gizleme */
@media (min-width: 769px) {
    .agl-info-area .agl-info-title,
    .agl-library-button-wrapper a.agl-open-library-btn {
        font-size: 1.2em !important;
    }
}

@media (max-width: 768px) {
    /* İkonu mobilde gizle */
    .agl-info-area .dashicons.dashicons-format-gallery {
        display: none;
    }

    .agl-modal-body {
        padding: 15px;
    }

    .agl-modal-filters {
        flex-direction: column;
    }

    .agl-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}