/* ========== TREE OF LOVE V4 - REDESIGNED STYLES ========== */
/* Professional, tree-first design with natural aesthetics */

/* Modal Container */
.tree-modal-v4 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.tree-modal-container {
    background: #FFFFFF;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

/* Header */
.tree-modal-header {
    position: relative;
    padding: 30px 30px 20px;
    text-align: center;
    border-bottom: 1px solid #E0E0E0;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #F5F5F5;
    border-radius: 50%;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #E0E0E0;
    transform: rotate(90deg);
}

.tree-title {
    font-size: 28px;
    font-weight: 600;
    color: #2E7D32;
    margin: 0 0 8px 0;
}

.tree-subtitle {
    font-size: 14px;
    color: #757575;
    margin: 0;
}

/* HERO: Tree Visualization */
.tree-hero-section {
    position: relative;
    padding: 40px 20px;
    background: linear-gradient(to bottom, #E3F2FD 0%, #F0F8FF 100%);
    min-height: 600px;
}

.tree-canvas {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Tree Statistics Overlay */
.tree-stats-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 40px;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-icon {
    font-size: 20px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2E7D32;
}

.stat-label {
    font-size: 11px;
    color: #757575;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Add Message Section */
.add-message-section {
    padding: 20px 30px;
    border-top: 1px solid #E0E0E0;
}

.add-message-toggle {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #66BB6A, #43A047);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.add-message-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.toggle-icon {
    font-size: 24px;
    font-weight: 300;
    transition: transform 0.3s;
}

.add-message-toggle.active .toggle-icon {
    transform: rotate(45deg);
}

.add-message-form {
    margin-top: 20px;
    animation: slideDown 0.3s ease;
}

.form-section {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #424242;
    margin-bottom: 12px;
}

/* Leaf Shape Grid */
.leaf-shape-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.shape-option {
    aspect-ratio: 1;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    background: #FAFAFA;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.shape-option:hover {
    border-color: #66BB6A;
    background: #F1F8E9;
}

.shape-option.selected {
    border-color: #43A047;
    background: #E8F5E9;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.shape-preview {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
}

.shape-name {
    font-size: 11px;
    color: #616161;
    text-align: center;
}

/* Leaf Color Grid */
.leaf-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
}

.color-option {
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #424242;
    box-shadow: 0 0 0 3px rgba(66, 66, 66, 0.2);
    transform: scale(1.15);
}

.color-option::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 20px;
    opacity: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.color-option.selected::after {
    opacity: 1;
}

/* Message Picker - Scrollable message options */
.message-picker-scroll {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    padding: 8px;
}

.message-option {
    padding: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #FAFAFA;
}

.message-option:hover {
    border-color: #66BB6A;
    background: #F1F8E9;
}

.message-option.selected {
    border-color: #43A047;
    background: #E8F5E9;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Message Input */
.message-input,
.name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.message-input {
    resize: vertical;
    min-height: 80px;
}

.message-input:focus,
.name-input:focus {
    outline: none;
    border-color: #66BB6A;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: #9E9E9E;
    margin-top: 4px;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #66BB6A, #43A047);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Recent Messages */
.recent-messages-section {
    padding: 30px;
    background: #FAFAFA;
    border-top: 1px solid #E0E0E0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #424242;
    margin: 0 0 20px 0;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #66BB6A;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-text {
    font-size: 14px;
    color: #424242;
    margin-bottom: 8px;
}

.message-meta {
    font-size: 12px;
    color: #9E9E9E;
}

/* Leaf Detail Modal */
.leaf-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.leaf-detail-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
}

.detail-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #F5F5F5;
    border-radius: 50%;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}

.leaf-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.leaf-message {
    font-size: 18px;
    color: #424242;
    margin-bottom: 16px;
    line-height: 1.6;
}

.leaf-author {
    font-size: 16px;
    font-weight: 600;
    color: #2E7D32;
    margin-bottom: 8px;
}

.leaf-date {
    font-size: 12px;
    color: #9E9E9E;
}

/* Floating Tree Button */
.tree-love-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #66BB6A, #43A047);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s;
    z-index: 1000;
}

.tree-love-button:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.5);
}

.tree-love-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #D32F2F;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .tree-modal-container {
        border-radius: 0;
        max-height: 100vh;
    }

    .tree-stats-overlay {
        gap: 15px;
        padding: 12px 20px;
    }

    .stat-value {
        font-size: 20px;
    }

    .leaf-shape-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .leaf-color-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .tree-love-button {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 20px;
        right: 20px;
    }
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes branchGrow {
    from {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dasharray: 1000;
        stroke-dashoffset: 0;
    }
}

@keyframes leafFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Tree SVG Styles */
.tree-branch {
    animation: branchGrow 1s ease-out both;
}

.leaf-group {
    animation: leafFadeIn 0.6s ease-out both;
    transition: transform 0.3s ease;
}

.leaf-group:hover {
    transform: scale(1.2);
}

/* Parallax Layers */
.parallax-layer {
    transition: transform 0.3s ease-out;
    will-change: transform;
}

/* Leaf Message Preview on Circles */
.leaf-message-preview {
    pointer-events: none;
    user-select: none;
}

/* Circular Leaf Interactions */
.leaf-circle-shape {
    transition: all 0.3s ease;
}

.leaf-circle:hover .leaf-circle-shape {
    filter: url(#leafGlow);
    r: 28;
}

/* Background Elements */
.cloud, .bird, .grass-blade {
    will-change: transform;
}

/* Hidden State */
.hidden {
    display: none !important;
}
