:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --tomato-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);

    --bg-dark: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: #b4b4c8;
    --text-muted: #6b6b8c;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(at 0% 0%, rgba(102, 126, 234, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(245, 87, 108, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    padding-top: 100px;
    /* Offset for sticky nav */
}

/* Tab Management */
.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Nav Bar Styles */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 15, 35, 0.95);
    border-bottom: 1px solid var(--border-color);
}

.text-up {
    color: #22c55e !important;
}

.text-down {
    color: #ef4444 !important;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    cursor: pointer;
}

.logo-emoji {
    -webkit-text-fill-color: initial;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active {
    border-bottom-color: #667eea;
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Responsive Navigation */
@media (max-width: 768px) {
    .nav-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15, 15, 35, 0.98);
        flex-direction: column;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }

    .nav-links.active {
        display: flex;
        animation: fadeInDown 0.3s ease;
    }

    .nav-link {
        display: block;
        padding: 0.75rem;
        border-radius: var(--radius-sm);
        border-bottom: none;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(255, 255, 255, 0.1);
        border-bottom: none;
    }
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-xl);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.hero-section h1 {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.service-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xl) var(--spacing-lg);
}

.service-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
    background: rgba(255, 255, 255, 0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.service-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.service-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.header-content {
    background: rgba(20, 20, 35, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.tomato-icon {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--tomato-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Card Styles */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    animation: fadeInUp 0.6s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

/* Form Styles */
.production-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: var(--spacing-md);
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Button Styles */
.btn-primary {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.5rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active,
.btn-primary.active {
    transform: translateY(0);
    background: var(--success-gradient);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Window Button Active State (Overrides inline styles) */
.win-btn-open.active,
.win-btn-close.active {
    background: var(--success-gradient) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-delete {
    padding: 0.5rem 1rem;
    background: var(--secondary-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-delete:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

/* Chart Styles */
.chart-container {
    position: relative;
    height: 400px;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Table Styles */
.data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.data-count {
    padding: 0.5rem 1rem;
    background: var(--success-gradient);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(255, 255, 255, 0.05);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

tbody tr:last-child {
    border-bottom: none;
}

td {
    padding: 1rem;
    color: var(--text-primary);
}

.empty-state td {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* Footer */
.footer {
    text-align: center;
    padding: var(--spacing-lg) 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.footer-content p {
    margin-bottom: 4px;
}

.footer-content p:last-child {
    margin-bottom: 0;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

html {
    font-size: 112.5%;
    /* Increase base font size to ~18px */
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
        padding-top: 90px;
    }

    h1 {
        font-size: 1.75rem;
    }

    .card {
        padding: var(--spacing-md);
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .production-form {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
    }

    .sensor-mini-card {
        padding: var(--spacing-sm);
    }

    .sensor-value {
        font-size: 1.1rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tomato-icon {
        font-size: 2.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .data-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
}

/* General Card Style */
.card {
    background: rgba(20, 20, 35, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

/* Meteo Section Styles */
.integrated-sensor-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.sensor-section-header {
    margin-bottom: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sensor-section-header h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.sensor-grid-mini {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

.external-weather {
    display: flex;
    flex-direction: column;
}

.header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.location-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-icon-only {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
    padding: 0;
}

.btn-icon-only:hover {
    transform: scale(1.2);
}

.external-weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    flex-grow: 1;
}

.ext-item {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.ext-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ext-icon {
    font-size: 1.4rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ext-content {
    display: flex;
    flex-direction: column;
}

.ext-item.full-row {
    grid-column: span 2;
    padding: var(--spacing-md);
}

.ext-val-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-progress-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.mini-progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.5s ease;
}

.ext-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.ext-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.weather-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

@media (max-width: 1100px) {
    .integrated-sensor-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {

    .sensor-grid-mini,
    .external-weather-grid {
        grid-template-columns: 1fr;
    }

    .ext-item.full-row {
        grid-column: span 1;
    }

    .sensor-mini-card {
        padding: var(--spacing-sm) var(--spacing-md) !important;
    }

    .ext-item {
        padding: var(--spacing-md) !important;
        gap: 20px;
    }

    .ext-icon {
        font-size: 2.8rem;
        width: 60px;
        height: 60px;
    }

    .ext-label {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .ext-value {
        font-size: 1.3rem;
    }

    .integrated-sensor-layout {
        gap: var(--spacing-md);
    }
}

.sensor-mini-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    margin-bottom: 0 !important;
}

.sensor-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sensor-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.sensor-text h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.sensor-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.sensor-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.meteo-analysis-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    align-items: stretch;
}

@media (max-width: 1100px) {
    .meteo-analysis-layout {
        grid-template-columns: 1fr;
    }
}

.meteo-analysis-layout>.card {
    min-width: 0;
    height: 100%;
    /* Ensure card fills the grid cell height */
    display: flex;
    flex-direction: column;
}

.meteo-chart-card {
    margin-bottom: 0 !important;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.sensor-selector {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.sensor-btn {
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sensor-btn.active {
    background: var(--primary-gradient);
    color: white;
}

.analysis-tool {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: 0 !important;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-good {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.status-bad {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.analysis-summary p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-val {
    font-size: 0.9rem;
    font-weight: 600;
}

.full-width {
    width: 100%;
    margin-top: auto;
}

.clickable {
    cursor: pointer;
}

/* Responsive adjustment for meteo layout */
@media (max-width: 992px) {
    .meteo-analysis-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .sensor-selector {
        width: 100%;
        overflow-x: auto;
    }
}

/* Login Section Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: var(--spacing-xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.login-header h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-xs);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.social-login {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.8rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-social:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-social:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-social:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.btn-naver {
    background: #03C75A;
    color: white;
}

.btn-kakao {
    background: #FEE500;
    color: #000000;
}

.btn-google {
    background: white;
    color: #444;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: var(--spacing-lg) 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 10px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.forgot-password {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: var(--text-primary);
}

.btn-secondary {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.login-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* Signup Specific Styles */
.signup-card {
    max-width: 520px;
}

.signup-tabs {
    display: flex;
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.signup-content.hidden {
    display: none;
}

.signup-content.active {
    animation: fadeInDown 0.4s ease-out;
}

.social-signup-guide {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--text-secondary);
    font-size: 1rem;
}

.vertical-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-link-internal {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.nav-link-internal:hover {
    text-decoration: underline;
}

/* Checkbox Style */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}


.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s;
}

.checkbox-container:hover input~.checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.checkbox-container input:checked~.checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container a {
    color: #667eea;
    text-decoration: none;
}

.checkbox-container a:hover {
    text-decoration: underline;
}

/* My Page Styles */
.profile-card {
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    margin: 0 auto var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-info {
    margin-bottom: var(--spacing-lg);
}

.profile-info h3 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.profile-email {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.join-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Consulting Section Styles */
.consulting-view {
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none;
}

.board-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    gap: var(--spacing-sm);
}

.search-bar {
    display: flex;
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.2rem;
    max-width: 400px;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    outline: none;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    padding: 0 0.5rem;
    cursor: pointer;
}

.board-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding-bottom: 80px;
    /* Space for Kakao Banner */
}

.post-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.post-item:hover {
    transform: translateY(-2px);
    border-color: #667eea;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xs);
}

.post-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.post-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.post-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-environment {
    background: rgba(79, 172, 254, 0.2);
    color: #4facfe;
}

.badge-crop {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-pest {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-system {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-other {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.status-badge {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.status-badge.answered {
    background: var(--success-gradient);
    color: white;
}

/* Detail View */
.btn-back {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
}

.post-detail-card {
    padding-bottom: 80px;
}

.post-header-detail {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.post-body {
    min-height: 200px;
    line-height: 1.8;
}

.post-image-area img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    max-height: 400px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.2);
}

.comments-section {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.comment-item {
    background: rgba(255, 255, 255, 0.02);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.comment-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.comment-form {
    display: flex;
    gap: var(--spacing-xs);
}

.comment-form input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: white;
}

/* Write Form */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

textarea {
    width: 100%;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    resize: vertical;
}

select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(30, 30, 47, 1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: white;
}

.file-upload-box {
    border: 2px dashed var(--border-color);
    padding: var(--spacing-lg);
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.file-upload-box:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.file-upload-box input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Kakao Banner */
/* Kakao Banner */
.kakao-banner {
    position: fixed;
    bottom: 30px;
    right: 30px;
    left: auto;
    transform: none;
    width: auto;
    max-width: 110px;
    /* 축소 상태 */
    background: #FEE500;
    color: #3b1e1e;
    padding: 12px;
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(254, 229, 0, 0.4);
    z-index: 900;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.kakao-banner.expanded {
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
    right: auto;
    width: 90%;
    max-width: 600px;
    padding: 1rem 1.5rem;
    justify-content: space-between;
}

.kakao-banner:hover {
    transform: translateY(-5px);
}

.kakao-banner.expanded:hover {
    transform: translateX(-50%) translateY(-5px);
}

.kakao-icon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.kakao-mini-text {
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 5px;
    /* 아이콘 옆 배치 */
    white-space: nowrap;
}

/* 구조 변경함: 아이콘 옆에 텍스트? 아님 아래? 위 index.html은 div wrapper로 감쌌음. column 방향이면 margin-top */
/* 플로팅 버튼이랑 맞추려면... 플로팅은 옆으로(row) 했음. */
/* index.html을 보니 .kakao-icon-wrapper 안에 span 두개 있음. */
/* .floating-btn과 달리 .kakao-banner는 미니 텍스트를 아이콘 아래에 두는게 나을 수도? */
/* 하지만 플로팅과 통일성 위해 옆으로? */
/* 일단 wrapper가 있으니 자유로움. */

.kakao-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s;
    overflow: hidden;
}

.kakao-banner.expanded .kakao-content {
    opacity: 1;
    width: auto;
    margin-left: 15px;
}

.kakao-banner.expanded .kakao-mini-text {
    display: none;
}

.kakao-icon {
    font-size: 1.5rem;
}

.kakao-text {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

.kakao-text strong {
    font-size: 0.95rem;
}

.kakao-text span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.kakao-arrow {
    font-weight: bold;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .board-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kakao-banner {
        bottom: 80px;
        /* Above bottom nav on mobile if app-like, otherwise keeps it clear */
        width: 95%;
    }
}

/* Pest Map Section Styles */
.forecast-section {
    margin-bottom: var(--spacing-lg);
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.forecast-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    position: relative;
    overflow: hidden;
}

.forecast-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.forecast-card.risk-high::before {
    background: #ef4444;
}

.forecast-card.risk-medium::before {
    background: #f59e0b;
}

.forecast-card.risk-low::before {
    background: #10b981;
}

.forecast-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forecast-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-xs);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-good {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.map-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    min-height: 500px;
}

.map-container-wrapper {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.pest-map {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-sm);
    z-index: 10;
}

.map-legend {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.risk-high {
    background: #ef4444;
    box-shadow: 0 0 5px #ef4444;
}

.dot.risk-medium {
    background: #f59e0b;
    box-shadow: 0 0 5px #f59e0b;
}

.dot.shop-marker {
    background: #3b82f6;
    border: 2px solid white;
}

.diagnosis-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.diagnosis-card {
    padding: var(--spacing-lg);
}

.small-upload {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.shop-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.shop-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    animation: fadeIn 0.4s ease;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-name {
    font-weight: 700;
    color: var(--text-primary);
}

.shop-dist {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.shop-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    /* Added to fix potential line-clamp lint error for descriptions */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    /* Limit to 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

@media (max-width: 900px) {
    .map-layout {
        grid-template-columns: 1fr;
    }

    .pest-map {
        height: 300px;
    }
}

/* AI Prediction Section */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.prediction-form-grid {
    background: rgba(255, 255, 255, 0.02);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.form-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.prediction-results-area {
    margin-top: var(--spacing-lg);
    animation: fadeInUp 0.5s ease;
}

.result-display-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.result-mini-card {
    background: var(--primary-gradient);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.result-label {
    font-size: 0.9rem;
    opacity: 0.8;
    color: white;
}

.result-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
}

.ai-insight-box {
    background: rgba(102, 126, 234, 0.1);
    border-left: 4px solid #667eea;
    padding: var(--spacing-md);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.ai-insight-box strong {
    display: block;
    margin-bottom: 8px;
    color: #667eea;
}

@media (max-width: 768px) {
    .result-display-grid {
        grid-template-columns: 1fr;
    }
}

/* Company Section */
.company-section {
    margin-top: var(--spacing-xl);
}

.company-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--spacing-xl);
    align-items: start;
}

.company-info .section-title {
    margin-bottom: var(--spacing-lg);
    font-size: 1.8rem;
}

.info-item {
    margin-bottom: var(--spacing-md);
}

.info-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.info-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.info-text a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.info-text a:hover {
    color: #667eea;
}

.company-map-container {
    height: 400px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.company-map {
    width: 100%;
    height: 100%;
}

@media (max-width: 900px) {
    .company-layout {
        grid-template-columns: 1fr;
    }

    .company-map-container {
        height: 300px;
    }
}

/* Image Preview Styles */
.image-preview-container {
    position: relative;
    margin-top: var(--spacing-sm);
    width: 100%;
    max-height: 250px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview-container.hidden {
    display: none;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.btn-remove-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(245, 87, 108, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
}

.btn-remove-preview:hover {
    transform: scale(1.1);
    background: #f5576c;
}

/* 게시글 수정/삭제 버튼 스타일 */
.post-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.post-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit,
.btn-delete {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-edit {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

.btn-delete {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

/* iOS Input Zoom 방지 */
@media screen and (max-width: 768px) {

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* 목록으로 돌아가기 배너 버튼 */
.btn-back-banner {
    display: block;
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    /* 렌더링 최적화 코드 제거 (맥북 크롬 충돌 방지) */
}

.btn-back-banner:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 모바일 글쓰기 취소 버튼 확대 */
@media screen and (max-width: 768px) {
    .btn-cancel {
        font-size: 1.1rem !important;
        padding: 0.8rem 1.2rem !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: #ff6b6b !important;
        font-weight: bold;
    }
}

/* 플로팅 상담 버튼 */
.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    max-width: 110px;
    /* 축소 상태 너비 (단톡방 텍스트 포함) */
}

.floating-mini-text {
    font-size: 0.9rem;
    font-weight: bold;
    margin-left: 8px;
    white-space: nowrap;
    opacity: 1;
}

.floating-btn.expanded .floating-mini-text {
    display: none;
}

.floating-btn.expanded {
    max-width: 300px;
    /* 확장 상태 너비 */
    padding: 12px 20px;
    border-radius: 20px;
}

.floating-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.floating-icon {
    font-size: 24px;
    min-width: 36px;
    text-align: center;
}

.floating-content {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    width: 0;
    /* 축소 시 내용 숨김 */
}

.floating-btn.expanded .floating-content {
    opacity: 1;
    width: auto;
    margin-right: 15px;
}

.floating-title {
    font-weight: bold;
    font-size: 0.95rem;
}

.floating-desc {
    font-size: 0.8rem;
    opacity: 0.9;
}

.btn-close-floating {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s;
}

.floating-btn.expanded .btn-close-floating {
    opacity: 0.8;
    width: auto;
}

.btn-close-floating:hover {
    opacity: 1;
}

/* 모바일 대응 */
@media screen and (max-width: 768px) {
    .floating-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* 상세 페이지에서 헤더 숨김 */
.consulting-header-hidden {
    display: none !important;
}

/* 플로팅 버튼 숨김 (컨설팅 탭 진입 시) */
.floating-btn.hidden {
    display: none !important;
}

@media (min-width: 1024px) {
    #root-zone .sensor-grid-mini {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ----------------------------------------------------
   Crop Analysis Dashboard Styles (작물 분석)
   ---------------------------------------------------- */
.crop-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: calc(100vh - 180px);
    /* Fill remaining height */
    min-height: 800px;
}

/* Common Card Style specific for this dashboard (Darker, thinner borders) */
.crop-dashboard-layout .card {
    background: #1e1e24;
    /* Slightly different dark */
    border: 1px solid #333;
    border-radius: 4px;
    /* Sharper corners for app-like feel */
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Left Panel: Camera */
.camera-panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #2a2a35;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #e0e0e0;
    font-weight: 500;
}

.cam-controls .btn-icon {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 0.9rem;
}

.camera-view-container {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.thermal-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* or contain based on preference */
}

/* Camera Overlay UI */
.cam-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    gap: 10px;
}

.cam-status {
    color: #f00;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    animation: blink 2s infinite;
}

.cam-time {
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    font-family: monospace;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* Right Side Tools in Camera View */
.cam-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(30, 30, 40, 0.8);
    padding: 10px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.btn-tool {
    background: #444;
    border: 1px solid #555;
    color: white;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center;
    transition: background 0.2s;
}

.btn-tool:hover {
    background: #555;
}

.btn-tool.primary {
    background: #3b82f6;
    border-color: #2563eb;
}

.btn-tool.danger {
    background: #ef4444;
    border-color: #dc2626;
}

.btn-tool.action {
    background: #10b981;
    border-color: #059669;
    font-weight: bold;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 5px 0;
}

.tool-group label {
    font-size: 0.75rem;
    color: #ccc;
}

.tool-group select {
    background: #222;
    border: 1px solid #444;
    color: white;
    padding: 4px;
    font-size: 0.85rem;
}

/* Right Panel: Analysis */
.analysis-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.dashboard-top-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #1e1e24;
}

.indicators {
    display: flex;
    gap: 15px;
}

.indicator-tag {
    background: #3b82f6;
    color: white;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 0.9rem;
}

.gauge-section,
.realtime-chart-section {
    padding: 15px;
    background: #1e1e24;
}

.section-title-bar {
    background: #3b82f6;
    color: white;
    padding: 8px 12px;
    margin: -15px -15px 15px -15px;
    /* Pull to edges */
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title-bar h4 {
    margin: 0;
    font-size: 1rem;
}

.target-select span {
    margin-left: 10px;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Gauges */
.gauge-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.gauge-item {
    background: #2a2a35;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #333;
}

.gauge-item h5 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #aaa;
    border-bottom: 2px solid #3b82f6;
    display: inline-block;
    padding-bottom: 2px;
}

.gauge-circle {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

/* Charts */
.chart-wrapper-small {
    height: 200px;
    width: 100%;
}

.chart-wrapper-medium {
    height: 300px;
    width: 100%;
}

.legend-checkboxes label {
    margin-left: 10px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
    .crop-dashboard-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .camera-panel {
        height: 500px;
        /* Fixed height for camera on mobile */
    }
}

/* ----------------------------------------------------
   Crop Analysis Dashboard V2 Styles (Redesign)
   ---------------------------------------------------- */
.crop-dashboard-layout-v2 {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Top Row: Camera + Gauges */
.crop-top-row {
    display: grid;
    /* Left: Camera (Fixed ratio or flex), Right: Gauges (remaining) */
    /* Camera usually 4:3. Let's try 2fr : 1fr or allow flexibility */
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: 500px;
    /* Fixed height to ensure alignment */
}

/* Ensure Camera Panel fills height */
.crop-top-row .camera-panel {
    height: 100%;
}

.camera-view-container {
    background: #000;
}

/* Gauge Panel (Right Side) */
.gauge-panel {
    background: #1e1e24;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    /* Prevent spill */
}

.dashboard-top-bar {
    padding: 10px;
    background: #2a2a35;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.dashboard-top-bar .indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.indicator-tag {
    font-size: 0.8rem;
    padding: 2px 6px;
}

.gauge-section-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
}

.gauge-grid-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Distribute evenly */
    height: 100%;
}

.gauge-item {
    background: #25252e;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px;
    flex: 1;
    /* Grow to fill space */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    border-bottom: 1px solid #444;
    padding-bottom: 3px;
}

.gauge-header h5 {
    margin: 0;
    font-size: 0.9rem;
    color: #ccc;
}

.gauge-header .gauge-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

.gauge-content-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.gauge-circle-small {
    width: 70px;
    height: 70px;
    position: relative;
    flex-shrink: 0;
}

.sparkline-container-small {
    flex: 1;
    height: 60px;
    background: #2a2a35;
    border-radius: 3px;
    border: 1px solid #333;
}

/* Bottom Row: Charts */
.crop-bottom-row {
    width: 100%;
}

.charts-container-row {
    display: flex;
    gap: 20px;
    padding: 15px;
}

.chart-wrapper-half {
    flex: 1;
    background: #25252e;
    padding: 10px;
    border-radius: 4px;
    height: 250px;
    /* Fixed height for bottom charts */
}

.chart-wrapper-half h5 {
    margin: 0 0 10px 0;
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .crop-top-row {
        grid-template-columns: 1fr;
        height: auto;
    }

    .camera-panel,
    .gauge-panel {
        height: auto;
        min-height: 400px;
    }

    .charts-container-row {
        flex-direction: column;
    }
}

/* Center gauge value inside circle */
.gauge-circle-small .gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: bold;
    font-size: 1.0rem;
    text-shadow: 1px 1px 2px #000;
}

@media (max-width: 768px) {
    .charts-container-row {
        flex-direction: column;
        height: auto !important;
    }

    .chart-wrapper-half {
        width: 100% !important;
        height: 250px !important;
        flex: none !important;
        margin-bottom: 15px;
    }
}

/* Fix overflow for sparklines in gauge items */
.gauge-content-row {
    min-width: 0;
    /* Important for flex containers */
}

.sparkline-container-small {
    min-width: 0;
    /* Allow shrinking */
    overflow: hidden;
    /* Cut off excess */
    position: relative;
    /* For Chart.js */
}

.gauge-item {
    overflow: hidden;
    /* Prevent item overflow */
}

/* Tighten Layout (Reduce Margins) */
.crop-dashboard-layout-v2 {
    gap: 8px !important;
}

.crop-top-row {
    gap: 8px !important;
}

.gauge-section-inner {
    padding: 5px !important;
}

.dashboard-top-bar {
    padding: 5px 10px !important;
}

.gauge-item {
    margin-bottom: 0 !important;
    /* Remove any default margins */
}

.gauge-grid-vertical {
    gap: 5px !important;
}