/* cdstyle_rwd.css - Modern UI/UX Redesign */

/* variables */
:root {
    --primary-color: #2e7d32;
    /* Forest Green */
    --secondary-color: #81c784;
    /* Light Green */
    --accent-color: #ff9800;
    /* Orange/Gold for highlights */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    /* Subtle gradient instead of old image if desired, or keep overlay */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-color);
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border-radius: 8px;
}

/* Layout Containers */
.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header img {
    max-height: 80px;
    transition: transform 0.3s ease;
}

.header img:hover {
    transform: scale(1.02);
}

.main-content {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

/* Flex Utilities & Grid */
.d-flex {
    display: flex;
    flex-wrap: wrap;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.nav-bar h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary-color);
    font-weight: 700;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    margin-left: 15px;
    color: var(--text-light);
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 20px;
}

.nav-links a:hover {
    background-color: var(--secondary-color);
    color: white;
}

.nav-links img {
    margin-left: 5px;
    height: 20px;
}

/* Butterfly Tree View */
.butterfly-list {
    margin-top: 20px;
}

.tree-node {
    margin-bottom: 10px;
}

/* Top Level Items (Families) */
.family-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 15px 20px;
    border-left: 5px solid var(--primary-color);
    transition: var(--transition);
}

.family-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.family-title {
    font-size: 1.1rem;
    font-weight: bold;
    display: block;
    color: var(--text-color);
}

.family-title a {
    color: var(--text-color);
}

.family-title a:hover {
    color: var(--primary-color);
}

.family-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-left: 10px;
}

/* Sub Level Items (Species) */
.species-list {
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid #eee;
    margin-left: 10px;
}

.species-item {
    background: #f9f9f9;
    margin-bottom: 8px;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.species-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.species-name {
    font-weight: 600;
    color: #444;
}

.species-sci {
    font-style: italic;
    color: #888;
    font-size: 0.85rem;
    display: block;
}

/* Buttons & Controls */
.btn,
input[type=submit],
input[type=button] {
    background: linear-gradient(to right, #56ab2f, #a8e063);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(86, 171, 47, 0.3);
    transition: var(--transition);
}

.btn:hover,
input[type=submit]:hover,
input[type=button]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(86, 171, 47, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #555;
    box-shadow: none;
}

/* Footer & Stats Bar */
.stats-bar {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.radio-group label {
    margin-right: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.radio-group input {
    margin-right: 5px;
}

/* Slideshow Area */
#blindY img {
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 4px solid white;
}

/* Switch Button Modern */
.version-switch {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white !important;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pwa-btn {
    position: fixed;
    bottom: 70px;
    /* Above switch button */
    right: 20px;
    background: linear-gradient(135deg, #FF6B6B, #EE5253);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    border: none;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    z-index: 1001;
    cursor: pointer;
    transition: transform 0.2s;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-btn:hover {
    transform: scale(1.05);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.version-switch:hover {
    background: black;
    transform: scale(1.05);
}

/* Detail Page (i.php) Specifics */
.detail-header {
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.detail-header h2 {
    color: var(--primary-color);
    margin: 0;
}

.info-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.image-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    transition: var(--transition);
}

.image-card:hover {
    box-shadow: var(--shadow-md);
}

.image-card .meta {
    padding: 15px;
    background: #fcfcfc;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    color: #555;
}

/* Tree UI Modernization */
.search-container {
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    position: sticky;
    top: 60px;
    /* Below header */
    z-index: 90;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #eee;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(86, 171, 47, 0.1);
}

.family-group {
    background: white;
    margin-bottom: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.family-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
}

.family-header:hover {
    background: #f8f9fa;
}

.family-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.family-header .count-badge {
    background: #eee;
    color: #666;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.toggle-icon {
    font-weight: bold;
    color: #ccc;
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.family-group.active .toggle-icon {
    transform: rotate(45deg);
    /* Or 180deg */
    color: var(--accent-color);
}

.family-group.active .family-header {
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.species-list-container {
    display: none;
    /* Hidden by default */
    padding: 10px;
    background: #fafafa;
}

.family-group.active .species-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    /* Grid layout for items */
    gap: 10px;
}

/* Highlight matching text */
.highlight {
    background-color: #ffeeba;
    font-weight: bold;
}

/* Plant Page (p.php) */
.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.plant-card {
    background: white;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 15px;
    text-align: center;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.plant-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.plant-name {
    font-weight: bold;
    color: var(--primary-color);
    margin: 10px 0 5px;
}

.plant-sci {
    font-style: italic;
    color: #999;
    font-size: 0.85rem;
    margin-bottom: auto;
    /* Push content below to bottom */
}

/* Media Queries */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .main-content {
        padding: 15px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .nav-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .nav-links {
        margin-left: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-links a {
        margin-left: 0;
        background: #eee;
    }

    .species-item {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Mobile Header Optimization */
    .header {
        padding: 5px 0;
        margin-bottom: 15px;
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(5px);
        transition: transform 0.3s ease;
    }

    .header.nav-up {
        transform: translateY(-100%);
    }

    .header img {
        max-height: 45px;
        /* Significantly smaller on mobile */
    }
}