/* ========== MODAL STRUCTURE CSS (Layout & Functionality) ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    display: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    z-index: 9999;
    display: none;
    max-height: 90vh;
    //overflow: hidden;
}

.modal.visible {
    display: flex;
    flex-direction: column;
}

/* Allow modal to grow wider on larger screens */
@media (min-width: 768px) {
    .modal {
        max-width: 550px;
    }
}

@media (min-width: 1024px) {
    .modal {
        max-width: 600px;
    }
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    z-index: 1;
}

.modal-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-icon {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.modal-icon.hidden {
    display: none;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.modal-message {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
    font-weight: 300;
    white-space: pre-line;
    overflow-y: auto;
    flex-shrink: 1;
    min-height: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-shrink: 0;
}

.modal-actions.hidden {
    display: none;
}

.modal-btn {
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-block;
}

/* ========== MODAL THEME CSS (Colors, Fonts, Effects) ========== */
:root {
    /* Brand Colors */
    --color-primary: #0084c9;
    --color-primary-light: #00a5db;
    --color-neutral: #595959;
    --color-accent-green: #00db6d;
    --color-accent-yellow: #ffec0c;
    
    /* Modal Theme Colors */
    --modal-overlay-bg: rgba(0, 0, 0, 0.5);
    --modal-bg: white;
    --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    --modal-close-color: #b0b0b0;
    --modal-close-hover: #595959;
    --modal-icon-color: #0084c9;
    --modal-title-color: #595959;
    --modal-message-color: #777;
    
    /* Button Theme Colors */
    --btn-primary-start: #0084c9;
    --btn-primary-end: #00a5db;
    --btn-primary-text: white;
    --btn-primary-shadow: rgba(0, 132, 201, 0.3);
    --btn-secondary-bg: #f0f0f0;
    --btn-secondary-text: #595959;
    --btn-secondary-hover: #e0e0e0;
    
    /* Typography */
    --font-headers: 'Ruda', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

.modal-overlay {
    background: var(--modal-overlay-bg);
}

.modal {
    background: var(--modal-bg);
    box-shadow: var(--modal-shadow);
}

.modal-close-btn {
    color: var(--modal-close-color);
}

.modal-close-btn:hover {
    color: var(--modal-close-hover);
    transform: rotate(90deg);
}

.modal-icon {
    color: var(--modal-icon-color);
}

.modal-title {
    font-family: var(--font-headers);
    color: var(--modal-title-color);
}

.modal-message {
    font-family: var(--font-body);
    color: var(--modal-message-color);
}

.modal-btn {
    font-family: var(--font-body);
}

.modal-btn-primary {
    background: linear-gradient(135deg, var(--btn-primary-start) 0%, var(--btn-primary-end) 100%);
    color: var(--btn-primary-text);
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--btn-primary-shadow);
}

.modal-btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

.modal-btn-secondary:hover {
    background: var(--btn-secondary-hover);
}

/* Theme Variations */
.modal.theme-error {
    --modal-icon-color: #dc3545;
    --btn-primary-start: #dc3545;
    --btn-primary-end: #c82333;
    --btn-primary-shadow: rgba(220, 53, 69, 0.3);
}

.modal.theme-success {
    --modal-icon-color: #00db6d;
    --btn-primary-start: #00db6d;
    --btn-primary-end: #00c25e;
    --btn-primary-shadow: rgba(0, 219, 109, 0.3);
}

.modal.theme-success .modal-btn-primary {
    position: relative;
    overflow: hidden;
}

.modal.theme-success .modal-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transition: left 0.5s ease;
}

.modal.theme-success .modal-btn-primary:hover::before {
    left: 100%;
}

.modal.theme-warning {
    --modal-icon-color: #ffc107;
    --btn-primary-start: #ffc107;
    --btn-primary-end: #e0a800;
    --btn-primary-shadow: rgba(255, 193, 7, 0.3);
}

.modal.theme-info {
    --modal-icon-color: #0084c9;
    --btn-primary-start: #0084c9;
    --btn-primary-end: #00a5db;
    --btn-primary-shadow: rgba(0, 132, 201, 0.3);
}

/* Tooltip Trigger Styling */
.tooltip-trigger {
    position: relative;
    cursor: help;
    color: #0084c9;
    font-weight: 500;
	border-bottom: 1px dotted #0084c9;
    transition: color 0.2s ease;
}

.tooltip-trigger:hover {
    color: #00a5db;
}

/* Tooltip Container */
.tooltip-content {
    position: absolute;
    background-color: #595959;
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.4;
    max-width: 250px;
    width: max-content;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Initially hidden */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Tooltip Arrow */
.tooltip-content::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Show tooltip */
.tooltip-content.active {
    opacity: 1;
    visibility: visible;
}

/* Position: Bottom (default) */
.tooltip-content[data-position="bottom"] {
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.tooltip-content[data-position="bottom"]::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #595959 transparent;
}

/* Position: Top */
.tooltip-content[data-position="top"] {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.tooltip-content[data-position="top"]::before {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-color: #595959 transparent transparent transparent;
}

/* Position: Left */
.tooltip-content[data-position="left"] {
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

.tooltip-content[data-position="left"]::before {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #595959;
}

/* Position: Right */
.tooltip-content[data-position="right"] {
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
}

.tooltip-content[data-position="right"]::before {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-color: transparent #595959 transparent transparent;
}

/* Mobile-specific: Make tooltips easier to dismiss */
@media (max-width: 768px) {
    .tooltip-content {
        max-width: 200px;
        font-size: 0.85rem;
    }
}