/* =====================================================
   INDEXEDDB EXPLORER - MODERN AESTHETIC DESIGN
   ===================================================== */

/* =====================
   MODAL CONTAINER
   ===================== */
.idb-modal {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.95) 100%);
    backdrop-filter: blur(12px);
    z-index: 7000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: idbFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.idb-modal.active {
    display: flex;
}

@keyframes idbFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(12px);
    }
}

/* Modal Content Container */
.idb-modal > .modal-content {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    border-radius: 24px;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.4),
        0 10px 30px rgba(108, 92, 231, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: idbSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 95vw;
    max-width: 1600px;
    height: 90vh;
    max-height: 900px;
}

@keyframes idbSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =====================
   MODAL HEADER
   ===================== */
.idb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
    position: relative;
    gap: 24px;
}

.idb-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6C5CE7, #a855f7, #ec4899, #f59e0b);
    background-size: 300% 100%;
    animation: idbGradientShift 4s ease infinite;
}

@keyframes idbGradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.idb-header-left {
    flex-shrink: 0;
}

.idb-modal-header h2,
.idb-modal-header h3 {
    margin: 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.idb-modal-header h2 i,
.idb-modal-header h3 i {
    background: linear-gradient(135deg, #6C5CE7, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.4rem;
    animation: idbIconPulse 2s ease-in-out infinite;
}

@keyframes idbIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Modal Actions Container */
.idb-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Close Button */
.idb-modal-close {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.35);
    position: relative;
    overflow: hidden;
}

.idb-modal-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.idb-modal-close:hover::before {
    width: 100%;
    height: 100%;
}

.idb-modal-close:hover {
    background: linear-gradient(135deg, #ee5a5a 0%, #dc2626 100%);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.idb-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* =====================
   DASHBOARD
   ===================== */
.idb-dashboard {
    padding: 20px 28px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid #e2e8f0;
}

.idb-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

/* Storage Card Special Styling */
.idb-storage-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
}

.idb-storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.idb-storage-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.idb-storage-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.idb-storage-used {
    color: #6C5CE7;
}

.idb-storage-separator {
    color: #94a3b8;
}

.idb-storage-total {
    color: #64748b;
}

.idb-storage-percentage {
    font-weight: 700;
    font-size: 0.9rem;
    padding: 3px 8px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.idb-storage-bar-container {
    margin-top: 10px;
}

.idb-storage-bar {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.idb-storage-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    position: relative;
}

.idb-storage-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    animation: idbBarShine 2s ease-in-out infinite;
}

@keyframes idbBarShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.idb-storage-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #64748b;
}

.idb-storage-label-left,
.idb-storage-label-right {
    font-weight: 500;
}

.idb-storage-label-left {
    color: #6C5CE7;
}

.idb-storage-label-right {
    color: #22c55e;
}

.idb-dashboard-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.idb-dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #6C5CE7;
}

.idb-card-icon {
    font-size: 2.5rem;
}

.idb-card-info {
    flex: 1;
}

.idb-card-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #6C5CE7;
    line-height: 1;
}

.idb-card-label {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* =====================
   MAIN CONTENT AREA
   ===================== */
.idb-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* =====================
   SIDEBAR
   ===================== */
.idb-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.idb-sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.idb-sidebar-title {
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 12px;
    padding: 0 10px;
}

.idb-database-list,
.idb-store-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.idb-database-item,
.idb-store-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #475569;
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.idb-database-item:hover,
.idb-store-item:hover {
    background: rgba(108, 92, 231, 0.08);
    color: #6C5CE7;
    border-color: rgba(108, 92, 231, 0.2);
}

.idb-database-item.active,
.idb-store-item.active {
    background: linear-gradient(135deg, #6C5CE7 0%, #a855f7 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.idb-database-icon,
.idb-store-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.idb-database-name,
.idb-store-name {
    flex: 1;
}

.idb-database-version {
    font-size: 0.75rem;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* =====================
   DATA AREA
   ===================== */
.idb-data-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

/* Toolbar */
.idb-toolbar {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.idb-search-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.idb-search-input {
    width: 100%;
    padding: 12px 20px 12px 44px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.idb-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.idb-search-wrapper:focus-within .idb-search-icon {
    color: #6C5CE7;
    transform: translateY(-50%) scale(1.1);
}

.idb-search-input:focus {
    outline: none;
    border-color: #6C5CE7;
    box-shadow: 
        0 0 0 4px rgba(108, 92, 231, 0.12),
        0 4px 16px rgba(108, 92, 231, 0.1);
}

.idb-search-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

/* Buttons */
.idb-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6C5CE7 0%, #8b5cf6 100%);
    color: white;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.3);
    position: relative;
    overflow: hidden;
}

.idb-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.idb-btn:hover::before {
    left: 100%;
}

.idb-btn:hover {
    background: linear-gradient(135deg, #5b4cdb 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.idb-btn:active {
    transform: translateY(0);
}

.idb-btn i {
    font-size: 0.95rem;
    transition: transform 0.3s ease;
}

.idb-btn:hover i {
    transform: scale(1.1);
}

/* Button Variants */
.idb-btn-refresh {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.idb-btn-refresh:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.idb-btn-refresh:hover i {
    animation: idbSpin 0.8s ease;
}

@keyframes idbSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.idb-btn-export {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.idb-btn-export:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.idb-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.idb-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.idb-btn-danger:hover i {
    animation: idbShake 0.5s ease;
}

@keyframes idbShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-5deg); }
    75% { transform: translateX(3px) rotate(5deg); }
}

/* =====================
   DATA TABLE
   ===================== */
.idb-data-table {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.idb-table-wrapper {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.idb-table {
    width: 100%;
    border-collapse: collapse;
    color: #334155;
}

.idb-table th,
.idb-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.idb-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #64748b;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    transition: all 0.2s;
}

.idb-table th:hover {
    color: #6C5CE7;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.idb-table th.sorted.asc::after {
    content: ' ↑';
    color: #6C5CE7;
}

.idb-table th.sorted.desc::after {
    content: ' ↓';
    color: #6C5CE7;
}

.idb-table tbody tr {
    transition: background 0.2s;
}

.idb-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.04);
}

.idb-table td {
    font-size: 0.9rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.idb-null {
    color: #94a3b8;
    font-style: italic;
}

.idb-object {
    color: #6C5CE7;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.actions-col {
    width: 100px;
    text-align: center;
}

.actions-cell {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.idb-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.idb-view-btn {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.idb-view-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.1);
}

.idb-delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.idb-delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* =====================
   PAGINATION
   ===================== */
.idb-pagination {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    border-top: 1px solid #e2e8f0;
}

.idb-page-btn {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
}

.idb-page-btn:hover:not(:disabled) {
    border-color: #6C5CE7;
    color: #6C5CE7;
    background: rgba(108, 92, 231, 0.05);
}

.idb-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.idb-page-info {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* =====================
   LOADING & EMPTY STATES
   ===================== */
.idb-loading,
.idb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
}

.idb-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(108, 92, 231, 0.15);
    border-top-color: #6C5CE7;
    border-radius: 50%;
    animation: idbSpinnerSpin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes idbSpinnerSpin {
    to { transform: rotate(360deg); }
}

.idb-empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.idb-empty-hint {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 8px;
}

/* =====================
   VIEW MODAL
   ===================== */
.idb-view-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 7100;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.idb-view-modal.active {
    display: flex;
}

.idb-view-content-wrapper {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    max-width: 800px;
    width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.idb-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
}

.idb-view-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.idb-view-title i {
    color: #6C5CE7;
}

.idb-view-actions {
    display: flex;
    gap: 10px;
}

.idb-view-content {
    flex: 1;
    overflow: auto;
    padding: 24px;
    background: #ffffff;
}

.idb-view-content pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* =====================
   NOTIFICATIONS
   ===================== */
#idbNotifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 7200;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.idb-notification {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 320px;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #6C5CE7;
    animation: idbSlideIn 0.3s ease;
}

@keyframes idbSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.idb-notification-success {
    border-left-color: #22c55e;
}

.idb-notification-error {
    border-left-color: #ef4444;
}

.idb-notification-warning {
    border-left-color: #f59e0b;
}

.idb-notification-info {
    border-left-color: #3b82f6;
}

.idb-notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.idb-notification-content {
    flex: 1;
}

.idb-notification-title {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.idb-notification-message {
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.4;
}

.idb-notification-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}

.idb-notification-close:hover {
    color: #64748b;
}

/* =====================
   RESPONSIVE DESIGN
   ===================== */
@media (max-width: 1024px) {
    .idb-sidebar {
        width: 220px;
    }
    
    .idb-dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .idb-main-content {
        flex-direction: column;
    }
    
    .idb-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .idb-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .idb-search-wrapper {
        min-width: 100%;
    }
    
    .idb-modal > .modal-content {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    
    .idb-dashboard-grid {
        grid-template-columns: 1fr;
    }
}
