/*
 * TQPro Admin Common Styles
 * Copyright (c) 2025. Perun Consulting Services FZ LLE
 *
 * Unified stylesheet for admin module pages:
 * - mktplan.html (Marketing Planning)
 * - offerman.html (Offer Management)
 * - cruisemgmt.html (Cruise Management)
 */

/* ==========================================================================
   1. CSS VARIABLES
   ========================================================================== */

:root {
    --primary-color: #362c5d;
    --primary-dark: #2a2149;
    --secondary-color: #FFC166;
    --success-color: #3adb76;
    --warning-color: #ffae00;
    --alert-color: #cc4b37;
    --info-color: #1779ba;
    --light-bg: #f8f9fa;
    --border-color: #e1e4e8;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */

body.tqadmin {
    background-color: var(--light-bg);
    font-family: 'Inter', 'Noto Sans', sans-serif;
}

/* ==========================================================================
   3. LAYOUT COMPONENTS
   ========================================================================== */

/* --- Tree Panel --- */
.tree-panel {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    height: calc(100vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tree-panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to right, #fafafa, #ffffff);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tree-panel-header h5 {
    margin: 0;
    font-weight: 600;
    color: #2d3748;
}

.tree-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* --- Workspace Panel --- */
.workspace-panel {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    height: calc(100vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Content Card --- */
.content-card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.content-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(to right, #fafafa, #ffffff);
}

.content-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    flex: 1;
}

.content-card-header .button {
    flex-shrink: 0;
    margin: 0;
    min-width: auto;
    width: auto;
}

.content-card-title i {
    margin-right: 10px;
    color: var(--primary-color);
}

.content-card-body {
    padding: 25px;
}

/* ==========================================================================
   4. FORM COMPONENTS
   ========================================================================== */

/* --- Form Sections --- */
.form-section {
    margin-bottom: 25px;
}

.form-section-title {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title > i {
    color: var(--primary-color);
}

/* --- Enhanced Form Inputs --- */
.tqadmin label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    display: block;
    font-size: 0.9rem;
}

.tqadmin input[type="text"],
.tqadmin input[type="number"],
.tqadmin input[type="date"],
.tqadmin input[type="datetime-local"],
.tqadmin textarea {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 15px;
    transition: var(--transition);
    font-size: 0.95rem;
}

.tqadmin select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 15px;
    padding-right: 2rem;
    height: 2.75rem;
    transition: var(--transition);
    font-size: 0.95rem;
}

.tqadmin input[type="text"]:focus,
.tqadmin input[type="number"]:focus,
.tqadmin input[type="date"]:focus,
.tqadmin input[type="datetime-local"]:focus,
.tqadmin select:focus,
.tqadmin textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(54, 44, 93, 0.1);
    outline: none;
}

/* --- Button Enhancements --- */
.tqadmin .button {
    border-radius: 6px;
    font-weight: 600;
    transition: var(--transition);
    padding: 5px 5px;
    font-size: 0.9rem;
    margin: 0 0 0 0;
}

.tqadmin .button.primary,
.tqadmin .button.perun-button {
    background: var(--primary-color);
    color: white;
}

.tqadmin .button.primary:hover,
.tqadmin .button.perun-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tqadmin .button.success {
    background: var(--success-color);
    color: white;
}

.tqadmin .button i {
    margin-right: 8px;
}

/* Button size classes */
.tqadmin .button.tiny {
    font-size: 0.75rem;
    padding: 0.35em 0.5em;
    text-align: center;
}

.tqadmin .button.tiny i {
    margin-right: 0;
}

.tqadmin .button.small {
    font-size: 0.75rem;
    padding: 5px 10px;
}

/* ==========================================================================
   5. TABLE COMPONENTS
   ========================================================================== */

/* --- Data Table Wrapper --- */
.data-table-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}

/* --- Enhanced Table Styles --- */
.tqadmin table.hover thead {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
}

.tqadmin table.hover thead th,
.tqadmin table.hover thead td {
    padding: 15px;
    font-weight: 600;
    color: #2d3748;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.tqadmin table.hover tbody tr {
    transition: var(--transition);
    cursor: pointer;
}

.tqadmin table.hover tbody tr:hover {
    background-color: #f7fafc;
}

.tqadmin table.hover tbody td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f1f1;
    margin-top: auto;
    margin-bottom: auto;
}

/* --- Selected Row --- */
.tqadmin .selected-row {
    background-color: #edf2f7 !important;
    border-left: 3px solid var(--primary-color);
}

/* ==========================================================================
   6. UI COMPONENTS
   ========================================================================== */

/* --- Status Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft { background: #e2e8f0; color: #4a5568; }
.status-active { background: #d1fae5; color: #065f46; }
.status-suspended { background: #fef9c3; color: #854d0e; }
.status-archived { background: #f3f4f6; color: #374151; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-completed { background: #f3f4f6; color: #374151; }
.status-inactive { background: #f8d7da; color: #842029; }
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d1e7dd; color: #0f5132; }
.status-rejected { background: #f8d7da; color: #842029; }

/* --- Toolbar --- */
.detail-toolbar,
.activity-toolbar {
    padding: 12px 20px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-toolbar .button,
.activity-toolbar .button {
    margin: 0;
    padding: 8px 15px;
    font-size: 0.85rem;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

/* --- Pagination --- */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fafafa;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 0.9rem;
    color: #718096;
}

/* --- Action Buttons --- */
.action-btn {
    padding: 6px 12px;
    margin: 0 2px;
    font-size: 0.85rem;
}

/* ==========================================================================
   7. DIALOG/MODAL STYLES
   ========================================================================== */

.tqadmin .modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: var(--shadow-lg);
}

.tqadmin .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to right, #fafafa, #ffffff);
}

.tqadmin .modal-header h5 {
    margin: 0;
    font-weight: 600;
    color: #2d3748;
}

.tqadmin .modal-body {
    padding: 20px;
}

.tqadmin .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==========================================================================
   8. TREE ITEM STYLES (Common to mktplan and cruisemgmt)
   ========================================================================== */

/* --- Generic Tree List --- */
.tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-node {
    margin-bottom: 5px;
}

.tree-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f7fafc;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.tree-header:hover {
    background: #edf2f7;
}

.tree-header.selected {
    background: #e2e8f0;
    border-left-color: var(--primary-color);
}

.tree-header .toggle-icon {
    margin-right: 10px;
    color: #718096;
    font-size: 0.8rem;
    width: 16px;
}

.tree-header .tree-name {
    flex: 1;
    font-weight: 600;
    color: #2d3748;
}

/* --- Child Items List --- */
.tree-children {
    list-style: none;
    margin: 0;
    padding-left: 30px;
    display: none;
}

.tree-children.expanded {
    display: block;
}

.tree-item {
    padding: 8px 12px;
    margin: 3px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.tree-item:hover {
    background: #edf2f7;
}

.tree-item.selected {
    background: #dbeafe;
    border-left: 2px solid var(--info-color);
}

.tree-item .tree-item-icon {
    margin-right: 8px;
    color: #718096;
}

.tree-item .tree-item-name {
    flex: 1;
}

/* ==========================================================================
   9. SECTION LAYOUTS
   ========================================================================== */

/* --- Top Section (20%) --- */
.top-section {
    height: 20%;
    min-height: 150px;
    border-bottom: 2px solid var(--border-color);
    padding: 15px 20px;
    background: linear-gradient(to bottom, #fafafa, #ffffff);
    overflow-y: auto;
}

.top-section h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Bottom/Detail Section (80%) --- */
.detail-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ==========================================================================
   10. INFO DISPLAY
   ========================================================================== */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    padding: 10px;
    background: #f7fafc;
    border-radius: 6px;
}

.info-item label {
    display: block;
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.info-item .value {
    font-weight: 600;
    color: #2d3748;
}

/* ==========================================================================
   11. TABS ENHANCEMENT
   ========================================================================== */

.tqadmin .nav-tabs {
    border-bottom: none;
    background: transparent;
}

.tqadmin .nav-tabs .nav-link {
    font-weight: 600;
    color: #4a5568;
    border-radius: 6px 6px 0 0;
}

.tqadmin .nav-tabs .nav-link:hover {
    background: #edf2f7;
}

.tqadmin .nav-tabs .nav-link.active {
    background: white;
    color: var(--primary-color);
}

.tqadmin .tab-content {
    border: none;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow-sm);
}

.tqadmin .tab-pane {
    padding: 20px;
}

/* ==========================================================================
   12. TQPRO COMPONENT LIBRARY STYLES
   ========================================================================== */

/* --- Validation --- */
.required-field::after {
    content: " *";
    color: var(--alert-color);
    font-weight: 700;
}

.is-invalid ~ .invalid-feedback,
.is-invalid + .invalid-feedback {
    display: block;
}

.invalid-feedback {
    display: none;
    font-size: 0.8rem;
    color: var(--alert-color);
    margin-top: 4px;
}

/* --- Toast Notifications --- */
#tq-toast-container {
    z-index: 1090;
}

.tq-toast {
    min-width: 280px;
    max-width: 420px;
    background: white;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tq-toast.show {
    opacity: 1;
}

.tq-toast .toast-body {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: #2d3748;
}

/* --- Loading Button --- */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

/* --- Confirm Dialog --- */
#tq-confirm-dialog .modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

#tq-confirm-dialog .modal-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

#tq-confirm-dialog .modal-body {
    padding: 16px;
}

#tq-confirm-dialog .modal-body p {
    margin: 0;
    color: #4a5568;
    font-size: 0.95rem;
}

#tq-confirm-dialog .modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

/* --- Pagination --- */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fafafa;
    border-top: 1px solid var(--border-color);
}

.pagination-wrapper .pagination {
    margin-bottom: 0;
}

.pagination-wrapper .pagination .page-link {
    font-size: 0.85rem;
    padding: 4px 10px;
}
