/* 
 * ==========================================
 *  LAYOUT
 *  - Gridstack overrides
 *  - Widget content styling
 *  - Drag handle
 *  - Responsive
 * ==========================================
 */

/* ==========================================
 *  GRIDSTACK OVERRIDES
 * ========================================== */

/* Widget content fills the grid cell */
.grid-stack-item-content {
    border-radius: var(--radius-lg);
    overflow: visible !important;
    inset: 8px !important;
}

/* Inner widget fills the content area */
.gs-widget {
    width: 100%;
    height: 100%;
    overflow: auto;
    border-radius: var(--radius-lg);
}

/* Drag handle cursor */
.gs-drag-handle {
    cursor: grab;
    user-select: none;
}

.gs-drag-handle:active {
    cursor: grabbing;
}

/* Drag hint icon */
.drag-hint {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    opacity: 0.4;
    letter-spacing: 2px;
    transition: opacity 0.2s;
    margin-left: 4px;
}

.gs-drag-handle:hover .drag-hint {
    opacity: 0.8;
}

/* Placeholder when dragging */
.grid-stack-placeholder>.placeholder-content {
    border: 2px dashed var(--color-accent) !important;
    border-radius: var(--radius-lg) !important;
    background: rgba(255, 149, 0, 0.05) !important;
}

/* Remove Gridstack default borders */
.grid-stack>.grid-stack-item>.grid-stack-item-content {
    border: none;
    background: none;
}

/* Resize handle styling */
.grid-stack>.grid-stack-item>.ui-resizable-se {
    width: 20px !important;
    height: 20px !important;
    bottom: 4px !important;
    right: 4px !important;
    background: none !important;
}

.grid-stack>.grid-stack-item>.ui-resizable-se::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--color-text-secondary);
    border-bottom: 2px solid var(--color-text-secondary);
    opacity: 0.3;
    transition: opacity 0.2s;
}

.grid-stack>.grid-stack-item:hover>.ui-resizable-se::after {
    opacity: 0.6;
}

/* ==========================================
 *  GENERIC CARD / WIDGET BASE
 * ========================================== */

/* Generic Card / Widget */
.panel,
.hero-card,
.result-card,
.profit-pill,
.history-section {
    background: var(--color-surface);
    display: block !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    /* Premium Border Lighting */
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Noise Texture */
.panel::before,
.hero-card::before,
.result-card::before,
.profit-pill::before,
.history-section::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 0;
}

/* Hover Lift (Subtle) – only when NOT dragging */
.panel:hover,
.hero-card:hover,
.result-card:hover,
.profit-pill:hover {
    transform: scale(1.005);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Disable hover transform on Gridstack items (conflicts with drag) */
.grid-stack-item .panel:hover,
.grid-stack-item .result-card:hover,
.grid-stack-item .profit-pill:hover {
    transform: none;
}

/* ==========================================
 *  PANEL & CONTENT TITLES
 * ========================================== */

.panel-title {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Content Area – for non-grid fallback */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Exposure Alignment Fix & Absolute Buttons */
.result-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.result-value {
    margin-top: auto;
}

/* Remove old pseudo element */
.result-card::after {
    display: none;
}

/* Profits */
.profit-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Utilities */
.ratio-bar-container {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .stats-widget {
        display: none;
    }
}