/* /assets/css/desktop.css */

/* ============================================
   Global Styles
============================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Temporary debug outline */
    /* outline: 1px solid red; */
}

html, body {
    font-family: Arial, sans-serif;
    height: 100%;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    /* Removed overflow: hidden to allow tooltips to display properly */
}

/* Define CSS variables for panel background image and opacity */
:root {
    --panel-background-image: url('/assets/img/AxiaBA-Umbrella.png'); /* Default for page-container */
    --panel-background-opacity: 0.24; /* Default opacity for page-container::before */
    --ribbon-opacity: 0.8; /* New variable for ribbon opacity */
    --header-height: 64px; /* Adjust based on actual header height */
    --footer-height: 40px; /* Adjust based on actual footer height */
    --logo-width: 152px;
    --settings-icon-width: 50px;
    --dropdown-shift: calc((var(--logo-width) - var(--settings-icon-width)) / -2);
}

/* ============================================
   Page Container Styles
============================================ */

/* Page Container with Background Image */
.page-container {
    position: relative; /* Establishes positioning context for pseudo-element */
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

/* Pseudo-element for Background Image */
.page-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* height: 100%; */
    height: calc(100vh - var(--footer-height)); /* Full height between header and footer */
    background-image: var(--panel-background-image, url('/assets/img/AxiaBA-Umbrella.png'));
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: var(--panel-background-opacity, 0.24);
    transition: background-image 0.5s ease, opacity 0.3s ease;
    z-index: -1; /* Places the background behind all other elements */
}

/* ============================================
   Overview Panel Styles
============================================ */

/* Removed background properties from .overview-panel */
.overview-panel {
    flex: 1; /* Ensures it takes available space */
    overflow-y: auto;
    box-sizing: border-box;
    padding: 20px;
    height: calc(100vh - var(--header-height) - var(--footer-height)); /* Full height between header and footer */
}

/* Ensure content within overview-panel is above the pseudo-element */
.overview-panel > * {
    position: relative;
    z-index: 1;
}


/* ============================================
   Header Styles
============================================ */

/* Page Header */
.page-header {
    background-color: #fff;
    padding: 10px 20px;
    display: grid;
    grid-template-areas: 'logo dropdown settings';
    grid-template-columns: auto 1fr auto;
    align-items: center;
    width: 100%;
    position: relative;
    overflow: visible; /* Ensure tooltips are visible */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Assign grid areas */
.product-logo {
    grid-area: logo;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

/* Views Dropdown Container */
.views-dropdown-container {
    grid-area: dropdown;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    left: var(--dropdown-shift); /* Shift left by half the difference between logo and settings icon widths */
}


.settings {
    grid-area: settings;
    position: relative; /* Establishes positioning context for dropdown */
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

/* Product Logo */
.product-logo a {
    position: relative; /* Establishes a positioning context for the tooltip */
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
}

.product-logo a::after {
    content: 'Open AxiaBA introduction page';
    position: absolute;
    bottom: 125%; /* Positions the tooltip above the logo */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Prevents tooltip from capturing mouse events */
    font-size: 14px;
    z-index: 20; /* Ensures tooltip appears above other elements */
}

.product-logo a::before {
    content: '';
    position: absolute;
    bottom: 115%; /* Positions the arrow just below the tooltip */
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.75) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 20;
}

.product-logo a:hover::after,
.product-logo a:hover::before,
.product-logo a:focus::after,
.product-logo a:focus::before {
    opacity: 1;
    visibility: visible;
}

.product-logo a img {
    display: inline-block;
    transition: filter 0.3s ease;
    height: 44px; /* Maintains aspect ratio */
    max-width: var(--logo-width); /* Restrict maximum width */
    width: auto;
}

.product-logo a:hover img,
.product-logo a:focus img {
    filter: brightness(1.2); /* Increases brightness on hover/focus */
}

/* Views Dropdown */
.views-dropdown-container {
    flex: 1; /* Allows the dropdown to take up available space */
}

.views-dropdown {
    /* Style the dropdown to resemble a title with a border */
    position: relative;
    border: 2px solid #ccc; /* Added border */
    border-radius: 8px; /* Rounded corners for aesthetics */
    padding: 5px 10px; /* Padding to prevent text and arrow from touching the border */
    background-color: #fff; /* White background for contrast */
    max-width: 90vw; /* Prevent it from exceeding viewport width */
    width: auto; /* Allow width to adjust based on content */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    cursor: pointer;
}

.views-dropdown select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: transparent;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    outline: none;
    text-align: center; /* Center-align the text */
    text-align-last: center; /* Center-align the last line of text */
    width: 100%; /* Ensure the select fills the container */
    padding-right: 30px; /* Space for the custom arrow */
    box-sizing: border-box;
}

.views-dropdown::after {
    content: '▼';
    position: absolute;
    right: 10px; /* Position the arrow inside the border */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 18px;
    color: #333;
}

/* Settings Icon */
.settings-icon {
    position: relative; /* Establishes a positioning context for the tooltip */
    display: flex;
    justify-content: center;
    align-items: center;
    width: var(--settings-icon-width); /* Fixed width to match logo */
    height: 50px; /* Ensure the icon container matches the logo height */
    cursor: pointer;
    font-size: 24px;
    user-select: none;
    margin: 0;
    padding: 0;
}

.settings-icon::after {
    content: 'Account actions';
    position: absolute;
    bottom: 125%; /* Positions the tooltip above the icon */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-size: 14px;
    z-index: 20;
}

.settings-icon::before {
    content: '';
    position: absolute;
    bottom: 115%; /* Positions the arrow just below the tooltip */
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.75) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 20;
}

.settings-icon:hover::after,
.settings-icon:hover::before,
.settings-icon:focus::after,
.settings-icon:focus::before {
    opacity: 1;
    visibility: visible;
}

/* Settings Dropdown */
.settings-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 60px; /* Adjusted to position below the icon */
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    max-width: 90vw; /* Ensure it doesn't exceed viewport width */
    width: auto; /* Allow width to adjust based on content */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 30; /* Above tooltips */
    border-radius: 4px;
}

.settings-dropdown.visible {
    display: block;
}

.dropdown-title {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
    color: #333;
}

.settings-dropdown ul {
    list-style: none;
}

.settings-dropdown ul li {
    margin-bottom: 10px;
}

.settings-dropdown ul li:last-child {
    margin-bottom: 0;
}

.settings-dropdown ul li a {
    text-decoration: none;
    color: #007bff;
    transition: color 0.2s ease;
}

.settings-dropdown ul li a:hover {
    color: #0056b3;
}

/* ============================================
   Ribbon Styles
============================================ */

/* Upper and Lower Ribbons */
.upper-ribbon,
.lower-ribbon {
    background-color: #fff;
    height: 5px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ribbon Container */
.ribbon {
    background-color: rgba(245, 245, 245, .9); /* Semi-transparent white */
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease; /* Smooth transition for opacity changes */
}

.ribbon-header-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.toggle-icon {
    cursor: pointer;
    font-size: 18px;
    user-select: none;
    flex-shrink: 0;
}

.ribbon-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    padding-left: 10px;
    display: inline-block;
}

.delete-all-link {
    margin-left: auto;
    color: #007bff;
    text-decoration: none;
}

.delete-all-link:hover {
    text-decoration: underline;
}

.ribbon-container {
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.ribbon-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.ribbon-table th,
.ribbon-table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.ribbon-table th {
    background-color: #f2f2f2;
    text-align: left;
}

.ribbon-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ribbon-table tr:hover {
    background-color: #ddd;
}

.editable-cell {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    overflow: hidden;
    background-color: #fff;
}

.editable-cell:focus {
    background-color: #eef;
    border-color: #007bff;
    outline: none;
}

/* ============================================
   Input and Feedback Styles
============================================ */

.text-input-container, .feedback-content {
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0 10px 10px 10px;
    background-color: #f9f9f9;
    border: 2px solid #ccc;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2),
                2px 2px 8px rgba(0, 0, 0, 0.1);
    transition: height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    height: auto;
    opacity: 1;
    overflow: hidden;
}

.text-input-container.collapsed, .feedback-content.collapsed {
    height: 0;
    padding: 0;
    opacity: 0;
}

.text-input-container.expanding, .feedback-content.expanding {
    height: auto;
    padding: 10px;
    opacity: 1;
}

.text-input-container.hidden, .feedback-content.hidden {
    display: none;
}

textarea#multi-line-input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
}

/* ============================================
   Control Panel Styles
============================================ */

/* Control Panel Styles */
.control-panel {
    position: relative;
    height: 100%;
    background-color: #ddd;
    overflow: hidden;
    transition: width 0.3s ease-in-out, max-width 0.3s ease-in-out; /* Transition width and max-width */
    border-top-right-radius: 15px;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.2),
                2px 2px 8px rgba(0, 0, 0, 0.1),
                2px 2px 12px rgba(0, 0, 0, 0.25);
    z-index: 10; /* Ensures control panel is above other elements */
    flex-shrink: 0; /* Prevents the panel from shrinking */
}

.control-panel.expanded {
    width: 16%; /* Expanded width */
    min-width: 144px; /* Ensure max-width aligns with width */
    overflow-y: auto;
}

.control-panel.collapsed {
    width: 28px; /* Collapsed width */
    min-width: 28px; /* Ensure max-width aligns with width */
    overflow-y: hidden;
}

/* Ensure the control panel uses 'width' instead of 'flex-basis' */
.panel-container {
    display: flex;
    flex-grow: 1;
    width: 100%;
    position: relative;
    height: calc(100vh - 110px); /* Adjust based on header and footer height */
}


.panel-title {
    text-align: center;
    padding: 10px;
    font-size: 18px;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
    color: #333;
}

.control-panel.expanded .panel-title {
    visibility: visible;
    opacity: 1;
}

.collapsed-title {
    position: absolute;
    top: 50%;
    left: 100%; /* Adjusted from 50% */
    transform: translateY(-50%) rotate(-90deg); /* Adjusted to prevent overflow */
    font-size: 18px;
    color: #333;
    white-space: nowrap;
    text-align: center;
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
    cursor: default;
    user-select: none;
    margin-left: 5px; /* Small offset */
}

.control-panel:not(.expanded):hover .collapsed-title {
    opacity: 0;
    color: #007bff;
}

.control-panel.expanded .collapsed-title {
    visibility: hidden;
    opacity: 0;
}

.pin-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    border: 2px solid #333;
    border-radius: 24%;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    z-index: 20; /* Ensure it's above other elements */
}

.pin-toggle::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 24%;
    transition: background-color 0.3s ease;
}

.pin-toggle.pinned {
    background-color: #007bff;
    border-color: #007bff;
}

.pin-toggle.pinned::before {
    background-color: white;
}

.tab-options {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.tab-options .list-group-item {
    cursor: pointer;
    padding: 15px;
    border: 1px solid #ddd;
    margin: 0 10px 10px 10px;
    text-align: center;
    background-color: #fff;
    transition: background-color 0.2s ease;
    visibility: hidden;
    opacity: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    border-radius: 4px;
}

.control-panel.expanded .tab-options .list-group-item {
    visibility: visible;
    opacity: 1;
}

.tab-options .list-group-item:hover {
    background-color: #e9ecef;
}

.tab-options .list-group-item.active {
    background-color: #007bff;
    color: white;
}

/* ============================================
   Footer Styles
============================================ */

.page-footer {
    background-color: #dbf5ed;
    color: #777;
    text-align: center;
    padding: 10px;
    border-top: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Spinner Styles
============================================ */

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: none; /* Hide spinner by default */
    margin-left: 10px;
    vertical-align: middle;
}

.spinner.visible {
    display: inline-block; /* Show spinner when 'visible' class is added */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Button Styles
============================================ */

/* Send Button Styles */
#send-all-btn {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

#send-all-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0px 6px 8px rgba(0, 0, 0, 0.2);
}

/* Save Data Button Styles */
#save-data-btn {
    background-color: #28a745; /* Green background to differentiate from Send button */
    color: white;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    margin-left: 10px; /* Spacing from Send button */
}

#save-data-btn:hover:not(:disabled) {
    background-color: #218838; /* Darker green on hover */
    transform: translateY(-2px);
    box-shadow: 0px 6px 8px rgba(0, 0, 0, 0.2);
}

#save-data-btn:disabled {
    background-color: #6c757d; /* Gray background when disabled */
    cursor: not-allowed;
    opacity: 0.65;
}

/* ============================================
   Responsive Styles
============================================ */

/* Small screens (≤512px) */
/* Small screens (≤512px) */
@media (max-width: 512px) {

    .page-container {
        height: 100vh;
        overflow-y: hidden;
        overflow-x: hidden;
    }

    .page-header {
        display: grid;
        grid-template-areas:
            'logo settings'
            'dropdown dropdown';
        grid-template-rows: auto auto;
        align-items: center;
        justify-items: stretch;
        padding: 10px 15px;
    }

    .product-logo {
        grid-area: logo;
        justify-self: start;
    }

    .settings {
        grid-area: settings;
        justify-self: end;
    }

    .views-dropdown-container {
        position: static;
        grid-area: dropdown;
        justify-content: stretch;
        margin-top: 10px;
        right: var(--dropdown-shift); /* Shift left by half the difference between logo and settings icon widths */

    }

    .views-dropdown {
        width: 100%;
        max-width: none;
        font-size: 18px;
    }

    .views-dropdown select {
        padding: 10px 15px;
        font-size: 18px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Adjust settings icon size on smaller screens */
    .settings-icon {
        font-size: 21px;
        padding: 21px;
    }

    /* Optional: Reduce logo size on smaller screens */
    .product-logo a img {
        height: 44px;
        max-width: 152px;
    }
    
    .control-panel.expanded {
        width: 21%; /* Expanded width */
        min-width: 144px; /* Ensure max-width aligns with width */
        overflow-y: auto;
    }
}



/* Optional: Add background color or border to the feedback-content if needed */

/* ============================================
   Accessibility Enhancements
============================================ */

/* Visually Hidden (Accessible to Screen Readers Only) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap; /* Prevent the text from wrapping */
    border: 0;
}

/* ============================================
   Additional Styles (If Any)
============================================ */

/* Add any additional styles here */
