/* ============================================================
   PERCHSOFT BUSINESS MANAGEMENT PLATFORM - v4.0.0
   Extracted from perchsoft.html (Phase 2: CSS Extraction)
   Beakin Network Developing LLC
   ============================================================ */

/* Shake animation for validation errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

/* ============================================================
   LOGIN OVERLAY STYLES
   ============================================================ */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0d2620 0%, #1a4d37 50%, #0d2620 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #2d6b4f;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.login-logo {
    max-width: 280px;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 30px;
}

.login-input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #2d6b4f;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: #4ade80;
}

.login-input::placeholder {
    color: #6b7280;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2d6b4f 0%, #1e4d37 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #3d8b6f 0%, #2e5d47 100%);
    transform: translateY(-2px);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 15px;
    min-height: 20px;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #2d6b4f;
    color: #6b7280;
    font-size: 11px;
}

#mainContent {
    display: none;
}

.user-bar {
    position: fixed;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-bottom-left-radius: 10px;
    border: 1px solid #2d6b4f;
    border-top: none;
    border-right: none;
    z-index: 1000;
    font-size: 12px;
    color: #9ca3af;
}

.user-bar span {
    color: #4ade80;
}

.logout-btn {
    background: none;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-left: 10px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #ef4444;
    color: white;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0d2620 0%, #1a4d37 50%, #0d2620 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e0e0e0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    margin-bottom: 20px;
    border: 2px solid #2d6b4f;
}

.header h1 {
    font-size: 28px;
    color: #fbbf24;
    margin-bottom: 5px;
}

.header h1 span {
    font-size: 36px;
}

.header .subtitle {
    color: #9ca3af;
    font-size: 14px;
}

.header .version {
    color: #4ade80;
    font-size: 12px;
    margin-top: 5px;
}

/* Panels */
.panel {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #2d6b4f;
}

.panel-title {
    font-size: 14px;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2d6b4f;
    letter-spacing: 1px;
}

/* Input Groups */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 5px;
}

.input-group input {
    padding: 10px 12px;
    border: 1px solid #2d6b4f;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 16px;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #4ade80;
}

.input-group input::placeholder {
    color: #6b7280;
}

.input-hint {
    font-size: 10px;
    color: #6b7280;
    margin-top: 3px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #2d6b4f 0%, #1a4d37 100%);
    color: #fbbf24;
    border: 2px solid #4ade80;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3d7b5f 0%, #2a5d47 100%);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
    color: #fecaca;
    border: 2px solid #ef4444;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.3);
    color: #9ca3af;
    border: 1px solid #4b5563;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 15px;
    font-size: 16px;
}

/* Results Panel */
.results-section {
    display: none;
}

.results-section.visible {
    display: block;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(45, 107, 79, 0.3);
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    color: #9ca3af;
    font-size: 14px;
}

.result-value {
    font-weight: bold;
    font-size: 16px;
}

.result-value.healthy {
    color: #4ade80;
}

.result-value.warning {
    color: #fbbf24;
}

.result-value.danger {
    color: #ef4444;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.status-healthy {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border: 1px solid #4ade80;
}

.status-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid #fbbf24;
}

.status-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
}

/* Recommendation Box */
.recommendation-box {
    background: rgba(251, 191, 36, 0.1);
    border: 2px solid #fbbf24;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.recommendation-box h4 {
    color: #fbbf24;
    margin-bottom: 10px;
    font-size: 14px;
}

.recommendation-ratio {
    font-size: 32px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin: 10px 0;
}

.recommendation-ratio span {
    color: #4ade80;
}

/* Projection Table */
.projection-table {
    width: 100%;
    margin-top: 10px;
    font-size: 13px;
}

.projection-table th {
    text-align: left;
    color: #9ca3af;
    padding: 8px;
    border-bottom: 1px solid #2d6b4f;
}

.projection-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(45, 107, 79, 0.3);
}

/* Apply Section */
.apply-section {
    display: none;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #2d6b4f;
}

.apply-section.visible {
    display: block;
}

.apply-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #fecaca;
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    border-top: 1px solid #2d6b4f;
}

.status-bar .firebase-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.status-dot.connected {
    background: #4ade80;
}

/* Messages */
.message {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    display: none;
}

.message.visible {
    display: block;
}

.message.success {
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid #4ade80;
    color: #4ade80;
}

.message.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
}

/* Footer spacing for status bar */
.footer-spacer {
    height: 60px;
}

/* Helper Buttons Row */
.helper-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 11px;
}

/* ============================================================
   AD MANAGEMENT PANEL STYLES
   ============================================================ */

.ad-panel-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 3px solid #fbbf24;
}

.ad-info-box {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 12px;
}

.ad-info-box ul {
    margin: 8px 0 0 20px;
    color: #e0e0e0;
}

.ad-info-box li {
    margin: 4px 0;
}

.client-select-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 15px;
}

.client-select-row .input-group {
    flex: 1;
}

.input-group select {
    padding: 10px 12px;
    border: 1px solid #2d6b4f;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
}

.input-group select:focus {
    outline: none;
    border-color: #4ade80;
}

.input-group textarea {
    padding: 10px 12px;
    border: 1px solid #2d6b4f;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 14px;
    width: 100%;
    min-height: 60px;
    resize: vertical;
}

.input-group textarea:focus {
    outline: none;
    border-color: #4ade80;
}

.client-details-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #2d6b4f;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    display: none;
}

.client-details-card.visible {
    display: block;
}

.client-details-card h4 {
    color: #fbbf24;
    margin-bottom: 12px;
    font-size: 14px;
    border-bottom: 1px solid #2d6b4f;
    padding-bottom: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stat-box .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #4ade80;
}

.stat-box .stat-label {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.stat-box.warning .stat-value {
    color: #fbbf24;
}

.stat-box.danger .stat-value {
    color: #ef4444;
}

.ad-image-preview {
    max-width: 360px;
    height: 70px;
    border: 2px solid #2d6b4f;
    border-radius: 0;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    color: #6b7280;
    font-size: 12px;
    overflow: hidden;
}

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

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.btn-success {
    background: linear-gradient(135deg, #166534 0%, #14532d 100%);
    color: #4ade80;
    border: 2px solid #22c55e;
}

.btn-success:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
}

.ads-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 12px;
}

.ads-table th {
    text-align: left;
    color: #fbbf24;
    padding: 10px 8px;
    border-bottom: 2px solid #2d6b4f;
    font-size: 11px;
}

.ads-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(45, 107, 79, 0.3);
    vertical-align: middle;
}

.ads-table tr:hover {
    background: rgba(74, 222, 128, 0.05);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #4b5563;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #22c55e;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.form-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid #2d6b4f;
}

.form-section h5 {
    color: #fbbf24;
    font-size: 13px;
    margin-bottom: 12px;
}

/* Reward Scale Table Styles */
#actionRewardsTable input.new-value {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #2d6b4f;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 13px;
    text-align: center;
}

#actionRewardsTable input.new-value:focus {
    outline: none;
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

#actionRewardsTable input.new-value:not(:placeholder-shown) {
    background: rgba(74, 222, 128, 0.15);
    border-color: #4ade80;
}

#actionRewardsTable .current-value {
    font-weight: bold;
    color: #fbbf24;
}

/* Nest Quest Difficulty Slider Styles */
.difficulty-slider-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.difficulty-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.difficulty-label-left {
    color: #4ade80;
    font-size: 12px;
    font-weight: bold;
}

.difficulty-label-center {
    color: #fbbf24;
    font-size: 24px;
    font-weight: bold;
}

.difficulty-label-right {
    color: #ef4444;
    font-size: 12px;
    font-weight: bold;
}

.difficulty-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right, #4ade80 0%, #fbbf24 50%, #ef4444 100%);
    outline: none;
    cursor: pointer;
}

.difficulty-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #1a4d37;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.difficulty-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.difficulty-slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #1a4d37;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.difficulty-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 10px;
    color: #6b7280;
}

.difficulty-preview {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #2d6b4f;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.preview-title {
    color: #fbbf24;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 12px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.preview-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}

.preview-label {
    display: block;
    font-size: 10px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.preview-value {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #4ade80;
}

/* Mercy Slider - Orange gradient for Battle Nest */
.mercy-slider {
    background: linear-gradient(to right, #4ade80 0%, #fbbf24 50%, #ef4444 100%) !important;
}

.mercy-slider::-webkit-slider-thumb {
    border-color: #f97316 !important;
}

.mercy-slider::-moz-range-thumb {
    border-color: #f97316 !important;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.level-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #2d6b4f;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}

.level-card.active {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.level-card-title {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 5px;
}

.level-card-value {
    font-size: 18px;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 8px;
}

.level-card-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.level-card-fill {
    height: 100%;
    background: linear-gradient(to right, #4ade80, #fbbf24, #ef4444);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
        padding: 20px !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .panel {
        background: white !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }
    
    .print-letterhead {
        text-align: center;
        margin-bottom: 30px;
        border-bottom: 2px solid #1a4d37;
        padding-bottom: 20px;
    }
    
    .print-letterhead img {
        max-height: 80px;
        margin-bottom: 10px;
    }
    
    .print-letterhead .tagline {
        font-style: italic;
        color: #666;
        margin: 5px 0;
    }
    
    .print-letterhead .company-info {
        font-size: 12px;
        color: #333;
    }
    
    .print-content {
        color: black;
    }
    
    .print-content h3 {
        color: #1a4d37;
        border-bottom: 1px solid #1a4d37;
        padding-bottom: 5px;
        margin: 20px 0 10px 0;
    }
    
    .print-footer {
        margin-top: 40px;
        padding-top: 20px;
        border-top: 1px solid #ccc;
        font-size: 11px;
        color: #666;
    }
}

.print-only {
    display: none;
}

/* ============================================================
   GRAPHIC ASSET CREATION STYLES
   ============================================================ */
.asset-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.asset-mode-toggle button {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #2d6b4f;
    background: rgba(0, 0, 0, 0.3);
    color: #9ca3af;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
}

.asset-mode-toggle button.active {
    background: linear-gradient(135deg, #2d6b4f 0%, #1a4d37 100%);
    color: #fbbf24;
    border-color: #4ade80;
}

.asset-mode-toggle button:hover:not(.active) {
    border-color: #4ade80;
    color: #e0e0e0;
}

.asset-form-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #1f2937;
}

.asset-form-section h4 {
    color: #fbbf24;
    font-size: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #374151;
    letter-spacing: 0.5px;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.asset-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.asset-field {
    display: flex;
    flex-direction: column;
}

.asset-field label {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.asset-field label .required {
    color: #ef4444;
}

.asset-field input,
.asset-field select,
.asset-field textarea {
    padding: 8px 10px;
    border: 1px solid #2d6b4f;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 13px;
}

.asset-field input:focus,
.asset-field select:focus,
.asset-field textarea:focus {
    outline: none;
    border-color: #4ade80;
}

.asset-field textarea {
    resize: vertical;
    min-height: 60px;
}

.asset-field .field-hint {
    font-size: 9px;
    color: #6b7280;
    margin-top: 3px;
}

.asset-field input:disabled,
.asset-field select:disabled {
    background: rgba(0, 0, 0, 0.5);
    color: #6b7280;
    cursor: not-allowed;
}

.image-upload-zone {
    border: 2px dashed #2d6b4f;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.2);
}

.image-upload-zone:hover {
    border-color: #4ade80;
    background: rgba(45, 107, 79, 0.1);
}

.image-upload-zone.dragover {
    border-color: #4ade80;
    background: rgba(45, 107, 79, 0.2);
}

.image-upload-zone.has-image {
    border-style: solid;
    border-color: #4ade80;
}

.image-upload-zone .upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.image-upload-zone .upload-text {
    color: #9ca3af;
    font-size: 12px;
}

.image-upload-zone .upload-specs {
    color: #6b7280;
    font-size: 10px;
    margin-top: 5px;
}

.image-upload-zone img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
}

.image-validation {
    margin-top: 8px;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
}

.image-validation.valid {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid #4ade80;
    color: #4ade80;
}

.image-validation.invalid {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.image-validation.warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid #fbbf24;
    color: #fbbf24;
}

.stat-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.stat-input-row label {
    width: 140px;
    font-size: 11px;
    color: #9ca3af;
}

.stat-input-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #2d6b4f;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 13px;
}

.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    padding: 6px 12px;
    border: 1px solid #2d6b4f;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.3);
    color: #9ca3af;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-chip:hover {
    border-color: #4ade80;
}

.tag-chip.selected {
    background: linear-gradient(135deg, #2d6b4f 0%, #1a4d37 100%);
    color: #fbbf24;
    border-color: #4ade80;
}

.asset-list-container {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
}

.asset-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid #1f2937;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.asset-list-item:hover {
    border-color: #4ade80;
    background: rgba(45, 107, 79, 0.1);
}

.asset-list-item.selected {
    border-color: #4ade80;
    background: rgba(45, 107, 79, 0.2);
}

.asset-list-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.asset-list-item .asset-info {
    flex: 1;
}

.asset-list-item .asset-name {
    color: #e0e0e0;
    font-size: 13px;
    font-weight: bold;
}

.asset-list-item .asset-details {
    color: #6b7280;
    font-size: 10px;
}

.asset-list-item .asset-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.asset-status.active {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.asset-status.draft {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.asset-status.inactive {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

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

.validation-summary {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
}

.validation-summary h5 {
    color: #fbbf24;
    font-size: 11px;
    margin-bottom: 8px;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    padding: 4px 0;
}

.validation-item.pass {
    color: #4ade80;
}

.validation-item.fail {
    color: #ef4444;
}

.validation-item.warn {
    color: #fbbf24;
}

.hidden {
    display: none !important;
}

/* ============================================
   TRAINING LAB STYLES
   ============================================ */

/* Step Indicator */
.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.step-indicator:hover {
    opacity: 0.8;
}
.step-indicator.active {
    opacity: 1;
}
.step-indicator.completed {
    opacity: 1;
}
.step-indicator .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #888;
}
.step-indicator.active .step-num {
    background: #a855f7;
    border-color: #a855f7;
    color: #fff;
}
.step-indicator.completed .step-num {
    background: #4ade80;
    border-color: #4ade80;
    color: #fff;
}
.step-indicator .step-label {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
}
.step-indicator.active .step-label {
    color: #a855f7;
}
.step-indicator.completed .step-label {
    color: #4ade80;
}

/* Training Steps */
.training-step {
    display: none;
}
.training-step.active {
    display: block;
}
.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}
.step-number {
    background: #a855f7;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}
.step-title {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}
.step-content {
    padding: 0 0 20px 0;
}
.step-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #333;
}

/* Code Input */
.code-input {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    background: #0d0d0d;
    border: 1px solid #333;
}

/* Instruction Box */
.instruction-box {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
}
.instruction-step {
    display: flex;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #222;
}
.instruction-step:last-child {
    border-bottom: none;
}
.instruction-num {
    background: #a855f7;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}
.instruction-text {
    flex: 1;
}
.instruction-text strong {
    color: #fff;
    display: block;
    margin-bottom: 5px;
}
.instruction-code {
    display: inline-block;
    background: #000;
    color: #4ade80;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    margin-top: 5px;
}
.btn-copy {
    background: #333;
    border: none;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 10px;
}
.btn-copy:hover {
    background: #444;
    color: #fff;
}
kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.2s;
    background: rgba(0,0,0,0.2);
}
.file-drop-zone.drag-over {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}
.file-drop-zone.has-file {
    border-color: #4ade80;
    border-style: solid;
}
.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.drop-icon {
    font-size: 32px;
    color: #666;
}
.drop-text {
    color: #888;
    font-size: 14px;
}
.drop-or {
    color: #555;
    font-size: 12px;
}
.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.file-icon {
    color: #4ade80;
    font-size: 24px;
}
.file-name {
    color: #4ade80;
    font-weight: bold;
}
.btn-remove {
    background: #ef4444;
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
}

/* Progress Bar */
.training-progress-bar {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}
.training-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #4ade80);
    transition: width 0.3s;
}

/* ============================================================
   BRAIN LAB STYLES
   ============================================================ */
.brain-tab-bar {
    display: flex; gap: 0; margin-bottom: 20px;
    background: rgba(0,0,0,0.3); border-radius: 8px; overflow: hidden;
}
.brain-tab {
    flex: 1; padding: 12px 8px; text-align: center;
    cursor: pointer; font-size: 12px; font-weight: bold;
    color: #888; background: transparent; border: none;
    transition: all 0.2s; border-bottom: 3px solid transparent;
}
.brain-tab:hover { color: #34d399; background: rgba(52,211,153,0.05); }
.brain-tab.active {
    color: #34d399; background: rgba(52,211,153,0.1);
    border-bottom-color: #34d399;
}
.brain-panel { display: none; }
.brain-panel.active { display: block; }

.bl-stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 12px; margin: 12px 0;
}
.bl-stat-card {
    text-align: center; padding: 12px 8px;
    background: rgba(0,0,0,0.3); border-radius: 8px;
    border: 1px solid rgba(52,211,153,0.15);
}
.bl-stat-val { font-size: 22px; font-weight: bold; }
.bl-stat-lbl { color: #888; font-size: 10px; margin-top: 4px; }

.bl-filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap;
    align-items: flex-end; margin-bottom: 15px;
}
.bl-filter-bar select, .bl-filter-bar input {
    padding: 8px 10px; border: 1px solid #2d6b4f;
    border-radius: 6px; background: rgba(0,0,0,0.3);
    color: #fff; font-size: 13px;
}
.bl-filter-bar label {
    font-size: 11px; color: #9ca3af; margin-bottom: 3px;
}
.bl-filter-group { display: flex; flex-direction: column; }

.bl-table {
    width: 100%; border-collapse: collapse; font-size: 12px;
}
.bl-table th {
    text-align: left; padding: 8px 10px; color: #34d399;
    border-bottom: 2px solid rgba(52,211,153,0.3);
    font-size: 11px; letter-spacing: 0.5px;
}
.bl-table td {
    padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #d1d5db; vertical-align: top; max-width: 280px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bl-table tr:hover td { background: rgba(52,211,153,0.04); }
.bl-row-pos { border-left: 3px solid #4ade80; }
.bl-row-neg { border-left: 3px solid #ef4444; }

.bl-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: bold;
}
.bl-badge-pos { background: rgba(74,222,128,0.15); color: #4ade80; }
.bl-badge-neg { background: rgba(239,68,68,0.15); color: #ef4444; }

.bl-pair-card {
    background: rgba(0,0,0,0.25); border: 1px solid rgba(52,211,153,0.15);
    border-radius: 8px; padding: 14px; margin-bottom: 10px;
}
.bl-pair-prompt { color: #fbbf24; font-size: 13px; margin-bottom: 8px; }
.bl-pair-response {
    color: #d1d5db; font-size: 12px; line-height: 1.5;
    max-height: 100px; overflow-y: auto;
    padding: 8px; background: rgba(0,0,0,0.2); border-radius: 4px;
}
.bl-pair-meta {
    display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.bl-tag {
    background: rgba(52,211,153,0.1); color: #34d399;
    padding: 2px 8px; border-radius: 10px; font-size: 10px;
}
.bl-import-preview {
    background: rgba(0,0,0,0.3); border-radius: 8px; padding: 15px;
    margin: 15px 0; border: 1px solid rgba(52,211,153,0.2);
}
.bl-rubric-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin: 10px 0;
}
.bl-rubric-item {
    padding: 8px; background: rgba(0,0,0,0.2);
    border-radius: 6px; font-size: 11px; color: #d1d5db;
}
.bl-rubric-name { color: #34d399; font-weight: bold; }
.bl-rubric-weight { color: #fbbf24; font-size: 10px; }
.bl-weight-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr;
    gap: 10px; align-items: center; padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.bl-weight-row input {
    padding: 6px 8px; border: 1px solid #2d6b4f;
    border-radius: 4px; background: rgba(0,0,0,0.3);
    color: #fff; font-size: 13px; text-align: center; width: 80px;
}
.bl-weight-row input:disabled { opacity: 0.4; cursor: not-allowed; }
.bl-page-controls {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; font-size: 12px; color: #888;
}

/* ============================================================
   DROPDOWN MENU SYSTEM (v4.0.0 - Perch Reorg)
   ============================================================ */
.menu-bar-wrapper {
    position: sticky;
    top: 0;
    z-index: 900;
    background: linear-gradient(180deg, #0f1d15 0%, #142a1e 100%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0;
    margin-bottom: 15px;
}
.menu-bar {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
    flex-wrap: wrap;
}
.menu-category {
    position: relative;
}
.menu-category-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 13px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.menu-category-btn:hover,
.menu-category-btn.active {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #1a2f22;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 950;
    padding: 6px 0;
}
.menu-dropdown.show {
    display: block;
    animation: menuFadeIn 0.15s ease-out;
}
@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.menu-item {
    display: block;
    width: 100%;
    padding: 10px 18px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}
.menu-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.menu-item.active-module {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
}
.menu-item-external {
    color: #f472b6;
    border-top: 1px dashed rgba(244, 114, 182, 0.2);
    margin-top: 4px;
    padding-top: 10px;
}

/* Hamburger for mobile */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    padding: 10px 16px;
    cursor: pointer;
}

/* Mobile menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
}
.mobile-menu-overlay.show { display: block; }
.mobile-menu-panel {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #1a2f22;
    z-index: 1001;
    overflow-y: auto;
    padding: 20px 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    animation: slideIn 0.2s ease-out;
}
@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
}
.mobile-menu-header span { color: #4ade80; font-weight: bold; font-size: 15px; }
.mobile-close-btn {
    background: none; border: none; color: #ccc;
    font-size: 22px; cursor: pointer; padding: 4px 8px;
}
.mobile-category-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 18px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}
.mobile-category-btn:hover { background: rgba(255,255,255,0.05); }
.mobile-category-btn .arrow { transition: transform 0.2s; font-size: 10px; }
.mobile-category-btn.expanded .arrow { transform: rotate(90deg); }
.mobile-submenu {
    display: none;
    padding-left: 16px;
}
.mobile-submenu.show { display: block; }
.mobile-submenu .menu-item {
    padding: 10px 18px;
    font-size: 13px;
}

@media (max-width: 768px) {
    .menu-bar { display: none; }
    .hamburger-btn { display: block; }
}

/* ============================================================
   MODULE OVERLAY SYSTEM
   ============================================================ */
.module-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 15px;
    border-radius: 8px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.module-overlay-title {
    color: #4ade80;
    font-size: 14px;
    font-weight: bold;
}
.module-close-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.module-close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Welcome dashboard (shown when no module open) */
#welcomeDashboard {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}
#welcomeDashboard h2 {
    color: #4ade80;
    font-size: 20px;
    margin-bottom: 10px;
}
#welcomeDashboard p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* Hidden sections by default (v4.0.0 overlay architecture) */
.perch-module {
    display: none;
}
.perch-module.module-visible {
    display: block;
    animation: moduleFadeIn 0.2s ease-out;
}
@keyframes moduleFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
