/* BlogGarden styles */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Courier New', monospace;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.blog-garden-container {
    position: relative;
    min-height: 100vh;
    padding: 20px;
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */

.garden-header {
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #8B4513;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.garden-header h1 {
    margin: 0 0 10px 0;
    color: #228B22;
    font-size: 2.5rem;
    text-shadow: 2px 2px 0px #FFF;
    font-weight: bold;
}

.garden-header p {
    margin: 0 0 20px 0;
    color: #8B4513;
    font-size: 1.1rem;
}

/* ─── Controls ───────────────────────────────────────────────────────────────── */

.garden-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.garden-btn {
    padding: 10px 20px;
    border: 2px solid #654321;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px #333;
}

.water-btn  { background: #4169E1; color: white; }
.harvest-btn { background: #DAA520; color: white; }
.plant-btn  { background: #32CD32; color: white; }
.back-btn   { background: #DC143C; color: white; }

.garden-btn:hover  { transform: translateY(-2px); box-shadow: 3px 3px 0px #333; }
.garden-btn:active { transform: translateY(0);    box-shadow: 1px 1px 0px #333; }

/* ─── Stats ──────────────────────────────────────────────────────────────────── */

.stats-panel {
    display: flex;
    gap: 20px;
    justify-content: center;
    background: rgba(139, 69, 19, 0.1);
    border-radius: 10px;
    padding: 10px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: #8B4513;
    font-size: 1.1rem;
}

/* ─── Garden field ───────────────────────────────────────────────────────────── */

.garden-field {
    position: relative;
    width: 100%;
    height: 600px;
    background: #90EE90;
    border: 4px solid #8B4513;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    cursor: grab;
}

.garden-field:active {
    cursor: grabbing;
}

.garden-viewport {
    position: relative;
    width: 1200px;
    height: 800px;
    transform-origin: 0 0;
    transition: transform 0.3s ease;
}

.field-background {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(34, 139, 34, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(34, 139, 34, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(34, 139, 34, 0.1) 0%, transparent 50%);
    background-size: 100px 100px;
}

.plants-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.connections-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* ─── Zoom controls ──────────────────────────────────────────────────────────── */

.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #654321;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
}

.zoom-label {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    color: #654321;
    margin-right: 4px;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #654321;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    color: #654321;
    box-shadow: 1px 1px 0px #333;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.zoom-btn:hover  { background: white; transform: translateY(-1px); box-shadow: 2px 2px 0px #333; }
.zoom-btn:active { transform: translateY(0); box-shadow: none; }

/* ─── Plants ─────────────────────────────────────────────────────────────────── */

.tag-plant {
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    text-align: center;
    min-width: 80px;
}

.plant-sprite {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 5px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}

.plant-label {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #228B22;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #228B22;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.tag-plant:hover           { transform: scale(1.1); z-index: 20; }
.tag-plant:hover .plant-sprite { transform: translateY(-5px); }

@keyframes growing  {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
@keyframes watered {
    0%   { filter: hue-rotate(0deg) brightness(1); }
    50%  { filter: hue-rotate(180deg) brightness(1.2); }
    100% { filter: hue-rotate(0deg) brightness(1); }
}
@keyframes harvested {
    0%   { transform: scale(1) rotateZ(0deg); }
    50%  { transform: scale(1.2) rotateZ(10deg); }
    100% { transform: scale(1) rotateZ(0deg); }
}

.tag-plant.growing   { animation: growing 2s ease-in-out infinite; }
.tag-plant.watered   { animation: watered 1s ease-in-out; }
.tag-plant.harvested { animation: harvested 0.5s ease-in-out; }

/* ─── Connections ────────────────────────────────────────────────────────────── */

.connection-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, #228B22, #32CD32, #228B22);
    opacity: 0;
    transform-origin: left center;
    transition: opacity 0.25s ease;
}

.connection-line.visible {
    opacity: 0.7;
    animation: connection-pulse 3s ease-in-out infinite;
}

@keyframes connection-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.8; }
}

/* ─── Decorations ────────────────────────────────────────────────────────────── */

.decoration {
    position: absolute;
    font-size: 1.5rem;
    z-index: 15;
    animation: decoration-bob 4s ease-in-out infinite;
}

.decoration.cloud {
    animation: cloud-drift 20s linear infinite;
}

@keyframes decoration-bob {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-5px); }
}

@keyframes cloud-drift {
    0%   { transform: translateX(-10px); }
    100% { transform: translateX(10px); }
}

/* ─── Info panel ─────────────────────────────────────────────────────────────── */

.info-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #8B4513;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.info-panel h3 {
    margin-top: 0;
    color: #228B22;
    font-size: 1.3rem;
}

#tag-info {
    color: #8B4513;
    line-height: 1.6;
}

.tag-details { margin-top: 10px; }

.tag-stats {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    font-size: 0.9rem;
}

.tag-connections { margin-top: 15px; }

.connection-tag {
    display: inline-block;
    background: rgba(34, 139, 34, 0.1);
    border: 1px solid #228B22;
    border-radius: 12px;
    padding: 3px 8px;
    margin: 2px;
    font-size: 0.8rem;
    color: #228B22;
}

/* ─── Special effects ────────────────────────────────────────────────────────── */

.sparkle-effect {
    position: absolute;
    color: #FFD700;
    font-size: 1rem;
    animation: sparkle 1s ease-out forwards;
    pointer-events: none;
    z-index: 30;
}

@keyframes sparkle {
    0%   { opacity: 1; transform: scale(0) rotate(0deg); }
    50%  { opacity: 1; transform: scale(1) rotate(180deg); }
    100% { opacity: 0; transform: scale(0.5) rotate(360deg) translateY(-20px); }
}

/* ─── Toast notification ─────────────────────────────────────────────────────── */

.garden-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(34, 139, 34, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #228B22;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.3);
    z-index: 1000;
    white-space: nowrap;
    animation: toast-in 0.25s ease, toast-out 0.3s ease 2.7s forwards;
}

.garden-toast.error {
    background: rgba(220, 20, 60, 0.95);
    border-color: #DC143C;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .blog-garden-container {
        padding: 10px;
    }

    .garden-header {
        padding: 12px 15px;
        margin-bottom: 12px;
    }

    .garden-header h1 {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }

    .garden-header p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }

    .garden-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        margin-bottom: 10px;
    }

    .garden-btn {
        width: auto;
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .zoom-controls {
        top: 5px;
        right: 5px;
        padding: 6px 8px;
    }

    .zoom-label { font-size: 0.8rem; }

    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .stats-panel {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        padding: 6px;
    }

    .stat { font-size: 0.9rem; }

    .garden-field {
        height: 420px;
        touch-action: none;
    }

    .garden-viewport {
        width: 1000px;
        height: 700px;
    }

    .plant-sprite { font-size: 2rem; }
    .plant-label  { font-size: 0.7rem; }
}
