/* BentWookie Web UI Styles - Golden Wookie Theme */

:root {
    /* Primary golden/amber palette from icons */
    --gold-primary: #D4A017;
    --gold-light: #F5D77A;
    --gold-dark: #B8860B;
    --gold-bg: #FFF8E7;
    --gold-border: #E8B823;

    /* Accent blue from icons */
    --blue-accent: #5FA8D3;
    --blue-light: #7EBCE6;
    --blue-dark: #4A90B8;

    /* Warm neutral palette */
    --cream: #FFFBF0;
    --cream-dark: #F5EED9;
    --brown-light: #8B7355;
    --brown-dark: #5D4E37;
    --brown-text: #3D3022;

    /* Status colors adjusted to match theme */
    --success: #5CB85C;
    --success-bg: #DFF0D8;
    --warning: #E8A832;
    --warning-bg: #FCF3CF;
    --danger: #D9534F;
    --danger-bg: #F2DEDE;
    --info: #5FA8D3;
    --info-bg: #D9EDF7;

    /* Grays with warm tint */
    --gray-50: #FDFCFA;
    --gray-100: #F7F5F2;
    --gray-200: #EBE7E0;
    --gray-300: #D4CFC5;
    --gray-500: #8B8579;
    --gray-700: #5D574D;
    --gray-900: #2D2A26;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--cream) 0%, var(--gold-bg) 100%);
    min-height: 100vh;
    color: var(--brown-text);
    line-height: 1.5;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--brown-dark) 0%, var(--brown-text) 100%);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(93, 78, 55, 0.3);
    border-bottom: 3px solid var(--gold-primary);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
}

.nav-brand a {
    color: var(--gold-light);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--cream);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-links li a img.nav-icon {
    height: 24px;
    width: 24px;
}

.nav-links li a:hover {
    background: rgba(212, 160, 23, 0.3);
    color: var(--gold-light);
    transform: translateY(-1px);
}

.nav-links li a.active {
    background: var(--gold-primary);
    color: var(--brown-dark);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gold-border);
}

.page-header h1 {
    margin: 0;
    color: var(--brown-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h1 img {
    height: 36px;
    width: 36px;
}

h1, h2, h3 {
    color: var(--brown-dark);
}

h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2 img {
    height: 28px;
    width: 28px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    border: 2px solid var(--gold-border);
    background: var(--cream);
    color: var(--brown-dark);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 115, 85, 0.15);
}

.btn:hover {
    background: var(--gold-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 115, 85, 0.2);
}

.btn img {
    height: 20px;
    width: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    border-color: var(--gold-dark);
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 100%);
    color: var(--brown-dark);
    text-shadow: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #4CAE4C 100%);
    border-color: #4CAE4C;
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #6ECF6E 0%, var(--success) 100%);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #D49A28 100%);
    border-color: #D49A28;
    color: var(--brown-dark);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #F5C04A 0%, var(--warning) 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #C9302C 100%);
    border-color: #C9302C;
    color: white;
}

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-sm img {
    height: 16px;
    width: 16px;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Cards and Panels */
.card, .detail-card, .stat-card, .status-section {
    background: var(--cream);
    border: 2px solid var(--gold-border);
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.15);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--cream);
    border-radius: 0.75rem;
    overflow: hidden;
    border: 2px solid var(--gold-border);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.15);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: linear-gradient(135deg, var(--gold-bg) 0%, var(--cream-dark) 100%);
    font-weight: 600;
    color: var(--brown-dark);
    font-size: 0.875rem;
    border-bottom: 2px solid var(--gold-border);
}

.table tbody tr:hover {
    background: var(--gold-bg);
}

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

.table a {
    color: var(--blue-dark);
    font-weight: 500;
}

.table a:hover {
    color: var(--gold-dark);
}

.table-sm th,
.table-sm td {
    padding: 0.5rem 0.75rem;
}

/* Forms */
.form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--brown-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: white;
    color: var(--brown-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.2);
}

.form-group input:disabled,
.form-control-disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-actions {
    display: flex;
    align-items: flex-end;
}

.inline-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.inline-form .form-group {
    margin-bottom: 0;
}

/* Filter Form */
.filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--cream);
    border: 2px solid var(--gold-border);
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.15);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--brown-light);
    font-weight: 600;
}

.filter-group select {
    padding: 0.5rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-lg {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.badge-phase {
    background: var(--info-bg);
    color: var(--blue-dark);
    border-color: var(--blue-accent);
}

.badge-tbd {
    background: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.badge-wip {
    background: var(--warning-bg);
    color: var(--brown-dark);
    border-color: var(--warning);
}

.badge-done {
    background: var(--success-bg);
    color: #3C763D;
    border-color: var(--success);
}

.badge-err,
.badge-tmout {
    background: var(--danger-bg);
    color: #A94442;
    border-color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--blue-dark);
    border-color: var(--blue-accent);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, var(--cream) 0%, var(--gold-bg) 100%);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 115, 85, 0.2);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--brown-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brown-dark);
}

.stat-success .stat-value {
    color: var(--success);
}

.stat-error .stat-value {
    color: var(--danger);
}

/* Section */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gold-border);
}

/* Detail Card */
.detail-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.detail-list {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.75rem;
}

.detail-list dt {
    font-weight: 600;
    color: var(--brown-light);
}

.detail-list dd {
    color: var(--brown-text);
}

/* Prompt Box */
.prompt-box {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 2px solid var(--gray-300);
}

.prompt-box pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    margin: 0;
    color: var(--brown-text);
}

/* Error Box */
.error-box {
    background: var(--danger-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 2px solid var(--danger);
}

.error-box pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    margin: 0;
    color: #A94442;
}

/* Status Section */
.status-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.status-section h2 {
    margin-bottom: 1rem;
    border-bottom: none;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: 2px solid;
}

.status-ok {
    background: var(--success-bg);
    color: #3C763D;
    border-color: var(--success);
}

.status-stopped {
    background: var(--gray-200);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.text-warning {
    color: var(--warning);
    font-weight: 700;
}

/* Loop Controls */
.loop-controls {
    margin-top: 1rem;
}

.loop-settings-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* Add Form Toggle (details/summary) */
.add-form-toggle {
    margin-top: 1rem;
}

.add-form-toggle summary {
    cursor: pointer;
    user-select: none;
}

.add-form-toggle[open] summary {
    margin-bottom: 1rem;
}

.add-form-toggle .form {
    max-width: none;
    padding: 1rem;
    background: var(--gold-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--gold-border);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 2px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--success-bg);
    color: #3C763D;
    border-color: var(--success);
}

.alert-error {
    background: var(--danger-bg);
    color: #A94442;
    border-color: var(--danger);
}

/* Empty State */
.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--brown-light);
    font-style: italic;
}

.empty-state a {
    color: var(--gold-dark);
    font-weight: 600;
}

.empty-state a:hover {
    color: var(--gold-primary);
}

/* Help Text */
.help-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--brown-light);
}

.help-text code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    font-family: 'Monaco', 'Menlo', monospace;
    border: 1px solid var(--gray-300);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--brown-light);
    font-size: 0.875rem;
    border-top: 2px solid var(--gold-border);
    background: linear-gradient(135deg, var(--cream-dark) 0%, var(--gold-bg) 100%);
    margin-top: 2rem;
}

.footer img {
    height: 32px;
    margin-bottom: 0.5rem;
}

/* Links */
a {
    color: var(--blue-dark);
    transition: color 0.2s;
}

a:hover {
    color: var(--gold-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .filter-form {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .detail-list dt {
        margin-top: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--cream-dark);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--gold-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
}
