/* ============================================
   Moon Phase Widget Styles
   Modern, clean design with CSS-drawn phases
   ============================================ */

/* Main Widget Container */
.maf-moon-widget {
    --maf-surface-base: #10131c;
    --maf-surface-alt: #151a23;
    --maf-border-soft: rgba(124, 136, 158, 0.24);
    --maf-accent-violet: #8c6efc;
    --maf-accent-cyan: #2ac7ff;
    --maf-text-primary: #f8fbff;
    --maf-text-muted: rgba(248, 251, 255, 0.65);
    background: linear-gradient(140deg, #0d111c 0%, #151a23 70%, #10131c 100%);
    border: 1px solid var(--maf-border-soft);
    border-radius: 14px;
    color: var(--maf-text-primary);
    padding: 26px;
    max-width: 540px;
    /*box-shadow: 0 18px 38px rgba(5, 7, 17, 0.55);*/
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.maf-moon-widget::after {
    content: "";
    position: absolute;
    inset: 6%;
    border-radius: inherit;
    background: radial-gradient(circle at 25% 25%, rgba(140, 110, 252, 0.16), transparent 65%);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.maf-moon-widget > * {
    position: relative;
    z-index: 1;
}

/* Header Section */
.maf-moon-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    /*margin-bottom: 20px;*/
}

/* Moon Phase Display (Left Side) */
.maf-moon-phase-display {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* CSS-Drawn Moon Phase Circle */
.maf-moon-phase-circle {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 35%, #dfe3ed 0%, #b7becd 60%, #949cad 100%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    overflow: hidden;
    --illumination: 0.5;
    --shadow-width: 0.5;
    --shadow-direction: 90deg;
}

.maf-moon-phase-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 35%, #f5f6fb 0%, #d6dae3 40%, #bbbfc9 75%, #9aa1ad 100%);
}

.maf-moon-phase-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: calc(var(--shadow-width) * 100%);
    height: 100%;
    background: linear-gradient(var(--shadow-direction, 90deg),
        rgba(6, 9, 15, 0.15) 0%,
        rgba(5, 8, 14, 0.55) 50%,
        rgba(5, 8, 14, 0.85) 100%);
    border-radius: 50%;
    opacity: calc(0.18 + (var(--shadow-width) * 0.62));
    filter: blur(0.2px);
    transition: width 0.6s ease, opacity 0.6s ease, background 0.4s ease;
    left: 0;
}

.maf-moon-phase-circle.maf-moon-phase--waning .maf-moon-phase-shadow,
.maf-moon-orb.maf-moon-phase--waning .maf-moon-orb-shadow {
    left: auto;
    right: 0;
    --shadow-direction: 270deg;
}

.maf-moon-phase-circle.maf-moon-phase--waxing .maf-moon-phase-shadow,
.maf-moon-orb.maf-moon-phase--waxing .maf-moon-orb-shadow {
    --shadow-direction: 90deg;
}

.maf-moon-phase-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


.maf-moon-phase-name {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--maf-text-primary);
}

.maf-moon-phase-percent {
    font-size: 0.85rem;
    color: var(--maf-accent-cyan);
    font-weight: 500;
}

/* Position Stats (Right Side) */
.maf-moon-position-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.maf-moon-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.maf-moon-stat-label {
    font-size: 0.75rem;
    color: var(--maf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.maf-moon-stat-value {
    font-size: 1rem;
    color: #d7e5ff;
    font-weight: 600;
}

/* Status and Warnings */
.maf-moon-status {
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--maf-text-muted);
}

.maf-moon-warning {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(128, 208, 255, 0.1);
    border: 1px solid rgba(128, 208, 255, 0.3);
    color: rgba(168, 225, 255, 0.95);
    font-size: 0.875rem;
    line-height: 1.4;
}

.maf-moon-warning--error {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: rgba(255, 159, 159, 0.95);
}

.maf-moon-warning--info {
    background: rgba(90, 248, 194, 0.08);
    border-color: rgba(90, 248, 194, 0.3);
    color: rgba(160, 255, 222, 0.95);
}

/* Arc Visualization */
.maf-moon-arc {
    margin-top: 28px;
}

.maf-moon-track {
    position: relative;
    height: 160px;
    overflow: visible;
}

/* SVG Path for smooth Bezier curve */
.maf-moon-path-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.maf-moon-path-bg {
    transition: opacity 0.4s ease;
}

.maf-moon-path-stroke {
    transition: stroke 0.4s ease;
}

/* Horizon Line */
.maf-moon-horizon {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg,
        rgba(90, 248, 194, 0.2) 0%,
        rgba(128, 208, 255, 0.55) 45%,
        rgba(199, 125, 255, 0.35) 100%);
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(128, 208, 255, 0.3);
    z-index: 2;
}

/* Moon Orb on Arc */
.maf-moon-body {
    position: absolute;
    width: 56px;
    height: 56px;
    transform: translate(-50%, 50%);
    z-index: 4;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.maf-moon-orb {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 35%, #ffffff 0%, #eef1f4 40%, #cfd6df 75%, #aeb7c4 100%);
    overflow: hidden;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.45),
        0 0 18px rgba(128, 208, 255, 0.35);
    --illumination: 0.5;
    --shadow-width: 0.5;
    --shadow-direction: 90deg;
}

.maf-moon-orb-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f2f4f8 32%, #dfe4ec 64%, #c1c9d6 100%);
}

.maf-moon-orb-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: calc(var(--shadow-width) * 100%);
    height: 100%;
    background: linear-gradient(var(--shadow-direction, 90deg),
        rgba(8, 12, 20, 0.05) 0%,
        rgba(5, 8, 15, 0.55) 55%,
        rgba(3, 5, 10, 0.9) 100%);
    border-radius: 50%;
    opacity: calc(0.25 + (var(--shadow-width) * 0.75));
    transition: width 0.6s ease, opacity 0.6s ease;
    left: 0;
}

/* State-based moon visibility */
.maf-moon-widget.maf-moon-state-before-rise .maf-moon-body,
.maf-moon-widget.maf-moon-state-after-set .maf-moon-body,
.maf-moon-widget.maf-moon-state-unknown .maf-moon-body {
    opacity: 0.5;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Moonrise/Moonset Labels */
.maf-moon-event {
    position: absolute;
    bottom: -52px;
    width: 140px;
    z-index: 5;
}

.maf-moon-event strong {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(90, 248, 194, 0.7);
    margin-bottom: 4px;
    font-weight: 600;
}

.maf-moon-event span {
    font-size: 1.05rem;
    color: #ffffff;
    font-weight: 600;
}

.maf-moonrise {
    left: 0;
    text-align: left;
}

.maf-moonset {
    right: 0;
    text-align: right;
}

/* Timezone Label */
.maf-moon-timezone {
    margin-top: 64px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 580px) {
    .maf-moon-header {
        flex-direction: column;
        gap: 16px;
    }

    .maf-moon-position-stats {
        flex-direction: row;
        gap: 20px;
        width: 100%;
    }

    .maf-moon-stat {
        align-items: flex-start;
        flex: 1;
    }
}

@media (max-width: 480px) {
    .maf-moon-widget {
        padding: 20px;
    }

    .maf-moon-phase-circle {
        width: 56px;
        height: 56px;
    }

    .maf-moon-track {
        height: 140px;
    }

    .maf-moon-body {
        width: 48px;
        height: 48px;
    }

    .maf-moon-event {
        width: 110px;
        bottom: -46px;
    }

    .maf-moon-event strong {
        font-size: 0.65rem;
    }

    .maf-moon-event span {
        font-size: 0.95rem;
    }

    .maf-moon-timezone {
        margin-top: 54px;
        font-size: 0.7rem;
    }
}

/* ============================================
   Enhanced Direction Display
   ============================================ */

/* Make direction text larger and more prominent */
.maf-moon-direction-primary {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: #2ac7ff !important;
    display: block !important;
    margin-bottom: 2px;
}

/* Show degree value as subtle detail */
.maf-moon-stat-detail {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    display: block;
}

/* When location is provided, hide the header moon to avoid duplication */
.maf-moon-widget .maf-moon-header .maf-moon-phase-display .maf-moon-phase-circle {
    display: block;
}

/* Show only arc moon when we have location and track data */
.maf-moon-widget.maf-moon-has-track .maf-moon-header .maf-moon-phase-display {
    justify-content: flex-start;
}

/* Optionally hide header moon entirely when arc is shown */
.maf-moon-widget.maf-moon-has-track .maf-moon-phase-circle {
    display: none;
}

/* Adjust spacing when header moon is hidden */
.maf-moon-widget.maf-moon-has-track .maf-moon-phase-info {
    margin-left: 0;
}

/* Remove gap from flex container when moon circle is hidden */
.maf-moon-widget.maf-moon-has-track .maf-moon-phase-display {
    gap: 0;
}

/* Mobile adjustments for direction */
@media (max-width: 480px) {
    .maf-moon-direction-primary {
        font-size: 1rem !important;
    }
}
