/* Lemon Tree Styles */
.lemon-tree-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Poppins', sans-serif;
}

/* Form Styles Improved */
.lemon-tree-form {
    margin-bottom: 30px;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.lemon-tree-form-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.input-container,
.button-container {
    width: 100%;
}

.lemon-tree-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    transition: all 0.3s ease;
}

.lemon-tree-input:focus {
    border-color: #D1AF77;
    outline: none;
    box-shadow: 0 0 0 3px rgba(209,175,119,0.2);
}

.lemon-tree-button {
    width: 100%;
    padding: 14px 30px;
    background: #D1AF77;
    color: #000;
    border: 2px solid #D1AF77;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lemon-tree-button:hover {
    background-color: #000;
    color: #D1AF77;
    border-color: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Results Container */
.lemon-tree-results {
    background: #fff;
    padding: 25px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.lemon-tree-details {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    line-height: 1.6;
}

.lemon-tree-sponsor {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #D1AF77;
}

/* Summary Styles */
.lemon-tree-summary {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.summary-item {
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    min-width: 200px;
}

.summary-item span {
    display: block;
    font-size: 1.5em;
    margin-top: 5px;
    font-weight: 600;
}

.first-line-summary {
    background: #F5E6CC;
    border: 2px solid #D1AF77;
    color: #000;
}

.second-line-summary {
    background: #E6F3FF;
    border: 2px solid #D1AF77;
    color: #000;
}

.third-line-summary {
    background: #E6F5EC;
    border: 2px solid #D1AF77;
    color: #000;
}

/* Network Tree Visualization */
.network-tree {
    padding: 40px 20px;
    overflow-x: auto;
    max-width: 100%;
    margin: 0 auto;
}

.network-tree::-webkit-scrollbar {
    height: 8px;
}

.network-tree::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.network-tree::-webkit-scrollbar-thumb {
    background: #D1AF77;
    border-radius: 4px;
}

.network-tree::-webkit-scrollbar-thumb:hover {
    background: #c19c64;
}

.tree-level {
    display: flex;
    justify-content: center;
    margin-bottom: 50px;
}

.tree-branches {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 80px;
    padding: 0 40px;
}

.tree-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-top: 30px;
}

.tree-branch::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    width: 2px;
    height: 30px;
    background: #D1AF77;
}

.tree-subbranch {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 30px;
    position: relative;
    padding-left: 60px;
}

.tree-subbranch::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    width: 2px;
    height: 30px;
    background: #D1AF77;
}

.tree-third-branch {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    padding-left: 60px;
    position: relative;
}

.tree-third-branch::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 30px;
    width: 2px;
    height: 20px;
    background: #D1AF77;
}

/* Node Styles with New Colors */
.tree-node {
    border: 2px solid #D1AF77;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    position: relative;
    min-width: 250px;
    z-index: 1;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.tree-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Root node: colore oro originale */
.tree-node.root {
    background: #D1AF77 !important;
    color: #000;
    margin-bottom: 30px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(209,175,119,0.3);
}

/* Prima linea: sfondo oro chiaro */
.tree-node.first-line {
    background: #F5E6CC !important;
    font-weight: 500;
    border-color: #D1AF77;
    color: #000;
}

/* Seconda linea: sfondo azzurro chiaro */
.tree-node.second-line {
    background: #E6F3FF !important;
    font-size: 0.95em;
    position: relative;
    border-color: #D1AF77;
    color: #000;
}

/* Terza linea: sfondo verde chiaro */
.tree-node.third-line {
    background: #E6F5EC !important;
    font-size: 0.9em;
    position: relative;
    border-color: #D1AF77;
    color: #000;
}

.tree-node.second-line::before,
.tree-node.third-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -30px;
    width: 30px;
    height: 2px;
    background: #D1AF77;
}

/* Stats Styling */
.first-line-stats,
.second-line-stats {
    font-size: 0.85em;
    color: #666;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.lemon-tree-empty {
    margin-top: 20px;
    text-align: center;
    color: #666;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
}

.lemon-tree-error {
    margin-top: 20px;
    color: #e65100;
    padding: 20px;
    background: #fff3e0;
    border-radius: 8px;
    border-left: 4px solid #e65100;
}

/* Responsive Styles */
@media screen and (max-width: 992px) {
    .tree-branches {
        gap: 60px;
    }
    
    .tree-node {
        min-width: 220px;
    }
}

@media screen and (max-width: 768px) {
    .tree-branches {
        flex-direction: column;
        align-items: center;
        gap: 50px;
    }

    .tree-branch {
        width: 100%;
        max-width: 300px;
    }
    
    .tree-subbranch,
    .tree-third-branch {
        padding-left: 30px;
    }
    
    .tree-node {
        min-width: 200px;
    }
    
    .tree-node.second-line::before,
    .tree-node.third-line::before {
        left: -20px;
        width: 20px;
    }
}

/* Print Styles */
@media print {
    .lemon-tree-form {
        display: none;
    }
    
    .lemon-tree-container {
        padding: 0;
    }
    
    .tree-node {
        box-shadow: none !important;
        border: 1px solid #000;
    }
}