/* session-timer.css */

/*
 * Session Timer Layout Styles
 * This file provides the structural layout for the session timer/active session view.
 * Visual overrides (colors, dark mode) are currently handled by inline styles in the PHP class
 * to ensure they override theme defaults forcefully.
 */

/* Main Grid Layout */
.pb-session-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Main content takes 2/3, Sidebar 1/3 */
    gap: 20px;
    width: 100%;
}

.pb-col-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pb-col-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Card Styles (Base structure, colors handled inline for dark mode) */
.pb-card {
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.pb-card-header {
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pb-card-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Timeline specific */
.pb-timeline-container {
    padding: 10px 0;
}

.pb-timeline-bar-bg {
    height: 10px;
    background: #333;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
}

.pb-timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 1s linear;
}

.pb-timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
}

/* Body Map - Dark Mode */
.pb-body-map-container {
    position: relative;
    border-radius: 8px;
    padding: 20px;
    /* Dark mode styling */
    background: #1a1a2e;
}

/* Invert the body outline image for dark mode visibility */
.pb-body-map-container .pb-body-outline {
    filter: invert(1) brightness(0.85);
    opacity: 0.9;
}

/* Markers - Base size for desktop */
.pb-map-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    cursor: help;
    transition: transform 0.2s;
    z-index: 10;
}

.pb-map-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 11;
}

.pb-marker-focus {
    background-color: rgba(76, 175, 80, 0.8);
    /* Green */
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.pb-marker-avoid {
    background-color: rgba(244, 67, 54, 0.8);
    /* Red */
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

/* Timer Display */
.pb-timer-wrapper {
    text-align: center;
}

.pb-timer-display {
    font-family: 'Courier New', monospace;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.pb-timer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pb-btn-control {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    background: #444;
    color: white;
}

.pb-btn-control:hover {
    background: #555;
}

.pb-btn-primary {
    background: #4CAF50;
    /* Green */
    color: white;
}

.pb-btn-primary:hover {
    background: #45a049;
}

.pb-btn-primary.active {
    background: #ff9800;
    /* Orange for Pause state if needed */
}

/* Pressure Options */
.pb-pressure-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pb-pressure-option {
    padding: 12px;
    text-align: center;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pb-pressure-option:hover {
    border-color: #666;
}

/* Notes */
.pb-session-notes textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #444;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
}

.pb-session-notes textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

/* =============================================
   RESPONSIVE STYLES
   ============================================= */

/* Landscape Tablet Optimization (768px - 1024px in landscape) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .pb-session-grid {
        grid-template-columns: 1.5fr 1fr;
        /* Give main content more space */
        gap: 15px;
    }

    .pb-card {
        padding: 15px;
    }

    .pb-card-title {
        font-size: 1.1rem;
    }

    .pb-timer-display {
        font-size: 2.5rem;
    }

    /* Ensure sidebar scrolls naturally with page */
    .pb-col-sidebar {
        position: relative;
        align-self: flex-start;
    }

    /* Better touch targets for tablet */
    .pb-btn-control {
        padding: 12px 24px;
        font-size: 1rem;
        min-height: 48px;
    }

    .pb-pressure-option {
        padding: 14px;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Reduce body map size slightly for more space */
    .pb-body-map-container img {
        max-height: 350px;
        width: auto;
    }

    /* Scale down consent map markers */
    .pb-map-marker {
        width: 12px;
        height: 12px;
        border-width: 1px;
    }
}

/* General Landscape Mode (any device in landscape under 900px height) */
@media (max-height: 600px) and (orientation: landscape) {
    .pb-session-grid {
        grid-template-columns: 1.5fr 1fr;
        gap: 10px;
    }

    .pb-card {
        padding: 12px;
    }

    .pb-card-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .pb-card-title {
        font-size: 1rem;
    }

    .pb-timer-display {
        font-size: 2rem;
        margin-bottom: 15px;
    }

    .pb-timer-controls {
        gap: 8px;
    }

    .pb-btn-control {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .pb-pressure-options {
        gap: 6px;
    }

    .pb-pressure-option {
        padding: 10px;
    }

    /* Scale down body map for limited vertical space */
    .pb-body-map-container img {
        max-height: 280px;
        width: auto;
    }

    /* Scale down consent map markers */
    .pb-map-marker {
        width: 10px;
        height: 10px;
        border-width: 1px;
    }

    .pb-timeline-bar-bg {
        height: 8px;
    }
}

/* Medium Tablets in Portrait (600px - 900px) - Keep 2-column */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
    .pb-session-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .pb-timer-display {
        font-size: 2.2rem;
    }

    .pb-body-map-container img {
        max-height: 400px;
    }

    /* Scale down consent map markers */
    .pb-map-marker {
        width: 14px;
        height: 14px;
        border-width: 1px;
    }
}

/* Mobile / Small Portrait (under 600px) - Stack columns */
@media (max-width: 599px) {
    .pb-session-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .pb-col-sidebar {
        order: -1;
        /* Show timer/controls ABOVE map on mobile */
    }

    .pb-timer-display {
        font-size: 2.5rem;
    }

    .pb-btn-control {
        padding: 12px 20px;
        min-height: 48px;
    }

    .pb-pressure-option {
        padding: 14px;
        min-height: 48px;
    }

    .pb-body-map-container img {
        max-width: 100%;
        height: auto;
    }

    /* Scale down consent map markers for mobile */
    .pb-map-marker {
        width: 10px;
        height: 10px;
        border-width: 1px;
    }
}

/* Touch-friendly improvements for all tablets */
@media (pointer: coarse) {

    .pb-btn-control,
    .pb-pressure-option,
    #pb-btn-end-session {
        min-height: 48px;
    }

}