/* BDD Jardín Botánico - Complete Stylesheet */

:root {
    --color-primary: #2d5a27;
    --color-primary-dark: #1e3d1a;
    --color-primary-light: #4a8c42;
    --color-secondary: #8b6914;
    --color-accent: #d4a84b;
    --color-background: #f5f7f3;
    --color-surface: #ffffff;
    --color-text: #2c3e2a;
    --color-text-light: #5a6d58;
    --color-border: #d4dcd2;
    --color-success: #28a745;
    --color-error: #dc3545;
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

a { color: var(--color-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--color-primary-light); }

/* Layout */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }

.top-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; z-index: 1000; box-shadow: var(--shadow-lg);
}

.header-brand { display: flex; align-items: center; }
.brand-link { display: flex; align-items: center; gap: 12px; color: white; }
.brand-link:hover { color: var(--color-accent); }
.brand-icon { font-size: 28px; }
.brand-link h1 { font-size: 20px; font-weight: 600; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.breadcrumb a { color: rgba(255,255,255,0.8); }
.breadcrumb a:hover { color: white; }
.breadcrumb .separator { color: rgba(255,255,255,0.5); }
.breadcrumb .current { color: var(--color-accent); font-weight: 500; }

.main-content { display: flex; margin-top: var(--header-height); min-height: calc(100vh - var(--header-height)); }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    position: fixed; top: var(--header-height); bottom: 0; left: 0;
    overflow-y: auto; padding: 16px 0;
}

.sidebar-nav { padding: 0 12px; }
.nav-section { margin-bottom: 24px; }
.nav-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--color-text-light);
    padding: 8px 12px; margin-bottom: 4px;
}
.nav-list { list-style: none; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 6px;
    color: var(--color-text); font-size: 14px; font-weight: 500;
    transition: var(--transition);
}
.nav-link:hover { background: var(--color-background); color: var(--color-primary); }
.nav-link.active { background: var(--color-primary); color: white; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }

/* Work Area */
.work-area { flex: 1; margin-left: var(--sidebar-width); padding: 24px; min-width: 0; }

/* Home Page */
.home-container { max-width: 1200px; margin: 0 auto; }
.welcome-section {
    text-align: center; padding: 40px 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white; border-radius: var(--border-radius); margin-bottom: 32px;
}
.welcome-section h2 { font-size: 28px; margin-bottom: 8px; }
.welcome-section p { opacity: 0.9; font-size: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card {
    background: var(--color-surface); border-radius: var(--border-radius);
    padding: 24px; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow); transition: var(--transition); color: var(--color-text);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--color-primary); }
.stat-icon { font-size: 36px; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 28px; font-weight: 700; color: var(--color-primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--color-text-light); margin-top: 4px; }

.quick-actions { background: var(--color-surface); border-radius: var(--border-radius); padding: 24px; box-shadow: var(--shadow); }
.quick-actions h3 { margin-bottom: 16px; color: var(--color-text); }
.action-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.action-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 20px; background: var(--color-primary); color: white;
    border-radius: 6px; font-weight: 500; transition: var(--transition);
}
.action-btn:hover { background: var(--color-primary-dark); color: white; }
.action-btn.secondary { background: var(--color-text-light); }
.action-btn.secondary:hover { background: var(--color-text); }

/* List View */
.list-container { background: var(--color-surface); border-radius: var(--border-radius); box-shadow: var(--shadow); overflow: hidden; }
.list-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--color-border);
    background: var(--color-background);
}
.list-header h2 { font-size: 20px; color: var(--color-text); }
.list-controls { display: flex; gap: 12px; }
.search-form { display: flex; align-items: center; gap: 8px; }
.search-input {
    padding: 8px 14px; border: 1px solid var(--color-border);
    border-radius: 6px; font-size: 14px; width: 250px; transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(45,90,39,0.1); }
.search-btn {
    padding: 8px 14px; background: var(--color-primary); color: white;
    border: none; border-radius: 6px; cursor: pointer; transition: var(--transition);
}
.search-btn:hover { background: var(--color-primary-dark); }
.clear-search { padding: 8px 12px; color: var(--color-text-light); font-size: 16px; }
.clear-search:hover { color: var(--color-error); }

.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--color-border); }
.data-table th { background: var(--color-background); font-weight: 600; font-size: 13px; color: var(--color-text-light); white-space: nowrap; }
.data-table tbody tr:hover { background: rgba(45,90,39,0.04); }
.data-table tbody tr.row-clickable { cursor: pointer; }
.data-table tbody tr.row-clickable:hover { background: rgba(45,90,39,0.08); }
.data-table td { font-size: 14px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-link { color: var(--color-text-light); display: flex; align-items: center; gap: 4px; }
.sort-link:hover, .sort-link.active { color: var(--color-primary); }
.actions-col { width: 80px; text-align: center; }
.btn-view { padding: 6px 10px; font-size: 16px; cursor: pointer; }
.empty-value { color: var(--color-border); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 20px; border-top: 1px solid var(--color-border); }
.page-link { padding: 8px 14px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 14px; }
.page-link:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.page-info { font-size: 14px; color: var(--color-text-light); }
.no-results { text-align: center; padding: 60px 20px; color: var(--color-text-light); }
.btn-clear { display: inline-block; margin-top: 12px; padding: 8px 16px; background: var(--color-primary); color: white; border-radius: 6px; }

/* Detail View */
.detail-container { background: var(--color-surface); border-radius: var(--border-radius); box-shadow: var(--shadow); overflow: hidden; }
.detail-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--color-border); background: var(--color-background);
}
.detail-header h2 { font-size: 20px; color: var(--color-text); }
.detail-actions { display: flex; gap: 8px; }

.btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition); }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: #218838; }
.btn-secondary { background: var(--color-text-light); color: white; }
.btn-secondary:hover { background: var(--color-text); }

.detail-fields { padding: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group.field-text { grid-column: 1 / -1; }
.field-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-light); }
.field-value { min-height: 36px; }
.display-value { padding: 8px 0; font-size: 15px; }
.edit-input { width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 15px; transition: var(--transition); }
.edit-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(45,90,39,0.1); }
textarea.edit-input { min-height: 120px; resize: vertical; }
.related-link { color: var(--color-primary); border-bottom: 1px dashed var(--color-primary); }
.related-link:hover { border-bottom-style: solid; }

.related-section { padding: 20px 24px; border-top: 1px solid var(--color-border); }
.related-section h3 { font-size: 16px; margin-bottom: 12px; color: var(--color-text); }
.related-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.related-list li { padding: 8px 12px; background: var(--color-background); border-radius: 4px; font-size: 14px; }
.related-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.related-table th, .related-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--color-border); }
.related-table th { background: var(--color-background); font-weight: 600; font-size: 12px; color: var(--color-text-light); }

/* Vocabulary */
.vocabulary-container { background: var(--color-surface); border-radius: var(--border-radius); box-shadow: var(--shadow); padding: 24px; }
.subtitle { color: var(--color-text-light); margin-top: 4px; }
.vocabulary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; }
.vocabulary-card { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--color-background); border-radius: 8px; color: var(--color-text); transition: var(--transition); }
.vocabulary-card:hover { background: var(--color-primary); color: white; transform: translateY(-2px); }
.vocab-icon { font-size: 24px; }
.vocab-name { font-weight: 500; font-size: 14px; }
.vocabulary-detail { background: var(--color-surface); border-radius: var(--border-radius); box-shadow: var(--shadow); overflow: hidden; }
.vocab-table .edit-input { padding: 6px 10px; width: calc(100% - 16px); }
.btn-edit-row, .btn-save-row, .btn-cancel-row { padding: 6px 10px; background: none; border: none; cursor: pointer; font-size: 16px; transition: var(--transition); }
.btn-edit-row:hover { transform: scale(1.1); }
.btn-save-row:hover { color: var(--color-success); }
.btn-cancel-row:hover { color: var(--color-error); }

/* Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 14px 24px; background: var(--color-text); color: white;
    border-radius: 8px; font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg); transform: translateY(100px); opacity: 0;
    transition: all 0.3s ease; z-index: 9999;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }

/* Messages */
.messages { margin-bottom: 20px; }
.message { padding: 12px 16px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.message.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
}
.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.editing .field-group { background: rgba(45,90,39,0.02); padding: 12px; border-radius: 6px; margin: -12px; margin-bottom: 8px; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .work-area { margin-left: 0; }
    .list-header { flex-direction: column; gap: 16px; align-items: stretch; }
    .search-input { width: 100%; }
    .detail-fields { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.logout-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--border-radius);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.logout-btn:hover { background: rgba(255,255,255,0.25); }
