/**
 * More Tools Panel Styles
 * Dashboard for tools like Code Scanner, Flash Loader, etc.
 * 
 * @package Alledio Production Dashboard
 * @version 1.0
 */

/* Panel overlay - Full screen, slide-in from right (like productDetailsModal) */
#moreToolsPanel {
    display: none;
    position: fixed;
    z-index: 5000;
    /* Same as Telemetry panel */
    top: var(--top-bar-height, 70px);
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100vh - var(--top-bar-height, 70px));
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: stretch;
    justify-content: flex-end;
    overflow: hidden;
    padding: 0;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.3s ease, left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When menu panel is open, shift entire panel to start after menu */
body.menu-open #moreToolsPanel {
    left: 200px;
    /* Width of menu panel */
}

/* Panel container - slides in from right, full width */
#moreToolsPanel .modal-container {
    background-image: url("../../images/bg_noise.webp"), linear-gradient(180deg, #f8f8f7, #f1f0ee);
    background-position: 0 0, 0 0;
    background-size: auto, auto;
    border-radius: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    width: 100%;
    height: 100%;
    margin: 0;
    border: none;
    border-left: 1px solid #dddfe0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    right: -100%;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Panel header */
#moreToolsPanel .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #dddfe0;
    flex-shrink: 0;
    background: white;
}

#moreToolsPanel .modal-header h2 {
    color: #2c3e50 !important;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

#moreToolsPanel .modal-header .modal-btn-cancel {
    width: auto;
    padding: 8px 16px;
    background: white;
    color: #2c3e50;
    border: 1px solid #dddfe0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

#moreToolsPanel .modal-header .modal-btn-cancel:hover {
    background: #f8f9fa;
    border-color: #b0bec5;
}

/* Panel body */
#moreToolsPanel .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#moreToolsPanel .modal-body::-webkit-scrollbar {
    display: none;
}

/* Tools grid - compact widget grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
    gap: 16px;
    margin-bottom: 24px;
}

/* Tools card - compact widget style */
.tools-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: white;
    border: 1px solid #e8ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.tools-card:hover {
    border-color: #2d8998;
    box-shadow: 0 4px 12px rgba(45, 137, 152, 0.15);
    transform: translateY(-2px);
}

.tools-card:active {
    transform: translateY(0);
}

/* Tool card icon */
.tools-card-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2fd 0%, #b8e0e8 100%);
    border-radius: 14px;
    color: #2d8998;
}

.tools-card-icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
}

/* Tool card content */
.tools-card-content {
    flex: 1;
    min-width: 0;
}

.tools-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 4px 0;
}

.tools-card-description {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* Hide arrow in grid layout */
.tools-card-arrow {
    display: none;
}

/* Empty state */
.tools-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: #9ca3af;
}

.tools-empty-state svg {
    width: 48px;
    height: 48px;
    stroke: currentColor;
    margin-bottom: 16px;
    opacity: 0.5;
}

.tools-empty-state p {
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.tools-empty-state span {
    font-size: 13px;
    color: #9ca3af;
}

/* Info section */
.tools-info-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #f0f7ff;
    border: 1px solid #e3f2fd;
    border-radius: 8px;
}

.tools-info-icon {
    flex-shrink: 0;
    color: #2d8998;
}

.tools-info-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.tools-info-content p {
    font-size: 12px;
    color: #555;
    margin: 0;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    #moreToolsPanel .modal-body {
        padding: 1.5rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .tools-card {
        padding: 16px 12px;
    }

    .tools-card-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .tools-card-icon svg {
        width: 24px;
        height: 24px;
    }

    .tools-card-title {
        font-size: 13px;
    }

    .tools-card-description {
        font-size: 10px;
    }
}

/* ==================== DARK MODE ==================== */
@media (prefers-color-scheme: dark) {
    #moreToolsPanel .modal-container {
        background-image: none;
        background: var(--color-bg-input-disabled, #0a0b0c);
        border-left-color: rgba(255, 255, 255, 0.12);
    }

    #moreToolsPanel .modal-header {
        background: var(--color-bg, #0f1113);
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }

    #moreToolsPanel .modal-header h2 {
        color: var(--color-text-primary, #e5e7eb) !important;
    }

    #moreToolsPanel .modal-header .modal-btn-cancel {
        background: var(--color-bg-input, #111315);
        color: var(--color-text-primary, #e5e7eb);
        border-color: rgba(255, 255, 255, 0.12);
    }

    #moreToolsPanel .modal-header .modal-btn-cancel:hover {
        background: var(--color-bg-hover, rgba(255, 255, 255, 0.1));
        border-color: rgba(255, 255, 255, 0.2);
    }

    .tools-card {
        background: var(--color-bg, #0f1113);
        border-color: rgba(255, 255, 255, 0.12);
    }

    .tools-card:hover {
        border-color: var(--color-primary, #2d8998);
        box-shadow: 0 4px 12px rgba(45, 137, 152, 0.1);
    }

    .tools-card-icon {
        background: linear-gradient(135deg, rgba(45, 137, 152, 0.2) 0%, rgba(45, 137, 152, 0.3) 100%);
    }

    .tools-card-title {
        color: var(--color-text-primary, #e5e7eb);
    }

    .tools-card-description {
        color: var(--color-text-tertiary, #94a3b8);
    }

    .tools-card-arrow {
        color: var(--color-text-tertiary, #6b7280);
    }

    .tools-empty-state p {
        color: var(--color-text-secondary, #cbd5e1);
    }

    .tools-empty-state span {
        color: var(--color-text-tertiary, #94a3b8);
    }

    .tools-info-section {
        background: rgba(45, 137, 152, 0.1);
        border-color: rgba(45, 137, 152, 0.2);
    }

    .tools-info-content p {
        color: var(--color-text-secondary, #cbd5e1);
    }
}