/**
 * 🔥 BASE MODAL STYLES
 * Universal modal system with native-feeling gestures
 */

/* ============================================
   OVERLAY
   ============================================ */
.base-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0; /* Extend behind nav bar to fill rounded corners */
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.base-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MODAL CONTENT
   ============================================ */
.base-modal-content {
    position: absolute;
    bottom: 0; /* Extend behind nav bar to fill rounded corner gaps */
    left: 0;
    right: 0;
    top: 0;
    background: var(--card-bg, #1a1a1a);
    /* 🔥 EDGE-TO-EDGE: No rounded corners at top - premium, not modal-ish */
    border-radius: 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Shadow still works great without radius */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    
    /* Prevent text selection during drag */
    user-select: none;
    -webkit-user-select: none;
    
    /* GPU acceleration */
    will-change: transform;
}

.base-modal-overlay.active .base-modal-content {
    transform: translateY(0);
}

/* During drag - disable transition for immediate feedback */
.base-modal-content.dragging {
    transition: none !important;
}

/* ============================================
   DRAG HANDLE
   ============================================ */
.base-modal-drag-handle {
    width: 36px;
    height: 4px;
    background: var(--text-secondary, #666);
    border-radius: 2px;
    margin: 12px auto 8px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ============================================
   HEADER
   ============================================ */
.base-modal-header {
    padding: 0 24px 16px;
    flex-shrink: 0;
}

.base-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--white, #fff);
    margin: 0;
    display: flex;
    align-items: center;
}

/* ============================================
   BODY
   ============================================ */
.base-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 24px calc(24px + var(--nav-height, 70px));
    /* Extra bottom padding so content scrolls above nav bar */
    
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Scrollbar styling */
.base-modal-body::-webkit-scrollbar {
    width: 4px;
}

.base-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.base-modal-body::-webkit-scrollbar-thumb {
    background: var(--text-secondary, #666);
    border-radius: 2px;
}

/* ============================================
   COMMON MODAL ELEMENTS
   ============================================ */

/* Section titles */
.base-modal-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 24px 0 12px;
}

/* Action buttons row */
.base-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.base-modal-actions .btn {
    flex: 1;
}

/* Close button (if needed) */
.base-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--white, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
    z-index: 10;
}

.base-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   INPUT STYLES (commonly used in modals)
   ============================================ */
.base-modal-input {
    width: 100%;
    background: var(--input-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--white, #fff);
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}

.base-modal-input::placeholder {
    color: var(--text-secondary, #888);
}

.base-modal-input:focus {
    border-color: var(--gold, #CFB56A);
    background: rgba(207, 181, 106, 0.05);
}

/* Large amount input */
.base-modal-amount-input {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--white, #fff);
    padding: 20px;
    width: 100%;
}

.base-modal-amount-input:focus {
    outline: none;
}

/* ============================================
   LIST ITEMS
   ============================================ */
.base-modal-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
    cursor: pointer;
    transition: background 0.2s;
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
}

.base-modal-list-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.base-modal-list-item:last-child {
    border-bottom: none;
}

.base-modal-list-item-icon {
    width: 44px;
    height: 44px;
    background: var(--input-bg, rgba(255, 255, 255, 0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold, #CFB56A);
    font-size: 18px;
    flex-shrink: 0;
}

.base-modal-list-item-content {
    flex: 1;
    min-width: 0;
}

.base-modal-list-item-title {
    font-weight: 600;
    color: var(--white, #fff);
    font-size: 15px;
}

.base-modal-list-item-subtitle {
    font-size: 13px;
    color: var(--text-secondary, #888);
    margin-top: 2px;
}

.base-modal-list-item-value {
    font-weight: 600;
    color: var(--white, #fff);
    font-size: 15px;
    text-align: right;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.base-modal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary, #888);
}

.base-modal-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.base-modal-empty p {
    margin: 0;
    font-size: 14px;
}

/* ============================================
   LOADING STATE
   ============================================ */
.base-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.base-modal-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-top-color: var(--gold, #CFB56A);
    border-radius: 50%;
    animation: base-modal-spin 0.8s linear infinite;
}

@keyframes base-modal-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   LIGHT THEME
   ============================================ */
body[data-theme="light"] .base-modal-content {
    background: var(--card-bg, #ffffff);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .base-modal-title {
    color: var(--text-primary, #1a1a1a);
}

body[data-theme="light"] .base-modal-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, #1a1a1a);
}

body[data-theme="light"] .base-modal-input:focus {
    background: rgba(207, 181, 106, 0.05);
}

body[data-theme="light"] .base-modal-list-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

body[data-theme="light"] .base-modal-list-item-title,
body[data-theme="light"] .base-modal-list-item-value {
    color: var(--text-primary, #1a1a1a);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 600px) {
    /* On larger screens, could optionally make modal narrower */
    .base-modal-content {
        /* max-width: 500px; */
        /* margin: 0 auto; */
    }
}
