/**
 * RackLens Custom Styles
 * Tool-specific styling that works with the theme system
 */

/* ========================================
   INDEX.HTML - Hub Page
   ======================================== */
.tool-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

body.dark-mode .tool-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.tool-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.tool-card.coming-soon:hover {
    transform: none;
}

/* Tool card layout - push "Open Tool" to bottom */
.tool-card .card {
    display: flex;
    flex-direction: column;
}

.tool-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tool-card .card-text {
    flex: 1;
}

.tool-card .tool-card-link {
    margin-top: auto;
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    z-index: 1;
}

/* Fix icon box background opacity colors */
.icon-box.bg-primary.bg-opacity-10 {
    background-color: rgba(var(--primary-rgb), 0.15) !important;
}

.icon-box.bg-info.bg-opacity-10 {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

.icon-box.bg-warning.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

.icon-box.bg-danger.bg-opacity-10 {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

.icon-box.bg-secondary.bg-opacity-10 {
    background-color: rgba(100, 116, 139, 0.15) !important;
}

/* Tool card text improvements */
.tool-card .card-text {
    color: var(--text-secondary) !important;
}

.tool-card .card-title {
    color: var(--text-primary) !important;
}

/* Feature badges on tool cards */
.tool-card .badge.bg-primary.bg-opacity-10 {
    background-color: rgba(var(--primary-rgb), 0.12) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

body.dark-mode .tool-card .badge.bg-primary.bg-opacity-10 {
    background-color: rgba(var(--primary-rgb), 0.2) !important;
    color: #a5b4fc !important;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.logo-img {
    height: 39px;
    margin-left: -16px;
}

/* ========================================
   PDUMAN.HTML - PDU Manager
   ======================================== */
.rotate-90 {
    transform: rotate(90deg);
}

.transition-transform {
    transition: transform 0.2s ease-in-out;
}

.status-normal {
    background-color: #08c517;
}

.status-warning {
    background-color: #ffc107;
}

.status-critical {
    background-color: #dc3545;
}

.clickable {
    cursor: pointer;
}

.three-dot-menu {
    position: relative;
}

.menu-dropdown {
    min-width: 130px;
    z-index: 1050;
}

.pdu-card-hover {
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.pdu-card-hover:hover {
    border-color: #d6d6d6 !important;
    border-width: 2px !important;
}

body.dark-mode .pdu-card-hover:hover {
    border-color: #475569 !important;
}

.pdu-card-selected {
    border-color: var(--primary) !important;
    border-width: 2px !important;
}

/* ========================================
   CABLEMAN.HTML - Cable Manager
   ======================================== */
.interactive-rack {
    background: linear-gradient(to bottom, #2c3e50 0%, #34495e 100%);
    border: 3px solid #1a252f;
    border-radius: 8px;
    padding: 8px 15px;
    position: relative;
    overflow-y: auto;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}

.rack-u-slot {
    background: linear-gradient(to right, #3d5a80, #4a6fa5);
    border: 1px solid #2c3e50;
    border-radius: 3px;
    padding: 4px 8px;
    margin: 2px 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ecf0f1;
    font-size: 11px;
    font-weight: 600;
}

.rack-u-slot:hover {
    background: linear-gradient(to right, #5aa9e6, #7fc8f8);
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(90, 169, 230, 0.4);
}

.rack-u-slot.selected {
    background: linear-gradient(to right, #27ae60, #2ecc71);
    border-color: #1e8449;
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(46, 204, 113, 0.5);
}

.rack-u-slot.selected-source {
    background: linear-gradient(to right, #3498db, #5dade2);
    border-color: #2874a6;
}

.rack-u-label {
    font-weight: bold;
    min-width: 30px;
}

.rack-u-indicator {
    width: 8px;
    height: 8px;
    background: #95a5a6;
    border-radius: 50%;
    opacity: 0.5;
}

.rack-u-slot:hover .rack-u-indicator {
    background: #f39c12;
    opacity: 1;
}

.rack-u-slot.selected .rack-u-indicator {
    background: #fff;
    opacity: 1;
}

.rack-diagram {
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #495057;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    min-height: 400px;
}

body.dark-mode .rack-diagram {
    background: linear-gradient(to bottom, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border-color: var(--border-color);
}

.rack-u-marker {
    position: absolute;
    left: 5px;
    font-size: 10px;
    color: #6c757d;
    font-weight: bold;
}

body.dark-mode .rack-u-marker {
    color: var(--text-muted);
}

.rack-visualization {
    margin-left: 30px;
    position: relative;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
}

body.dark-mode .rack-visualization {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.cable-path {
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
}

.cable-copper {
    stroke: #ffc107;
}

.cable-fiber {
    stroke: #0dcaf0;
}

.cable-power {
    stroke: #dc3545;
}

.rack-point {
    fill: var(--primary);
    stroke: #fff;
    stroke-width: 2;
}

.status-badge {
    font-size: 10px;
    padding: 2px 6px;
}

.cable-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 5px;
}

.cable-card-copper {
    border-left: 4px solid #ffc107;
}

.cable-card-fiber {
    border-left: 4px solid #0dcaf0;
}

.cable-card-power {
    border-left: 4px solid #dc3545;
}

.filter-chip {
    display: inline-block;
    padding: 4px 12px;
    margin: 2px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #dee2e6;
    background: white;
}

body.dark-mode .filter-chip {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.bend-radius-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

body.dark-mode .bend-radius-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--text-primary);
}

.bulk-order-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
}

body.dark-mode .bulk-order-item {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

.pathway-option {
    cursor: pointer;
    transition: all 0.2s;
}

.pathway-option:hover {
    background: #f8f9fa;
}

body.dark-mode .pathway-option:hover {
    background: var(--bg-elevated);
}

.pathway-option.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

body.dark-mode .pathway-option.selected {
    background: rgba(var(--primary-rgb), 0.15);
}

.mini-rack {
    width: 60px;
    height: 120px;
    background: linear-gradient(to bottom, #e9ecef, #dee2e6);
    border: 2px solid #495057;
    border-radius: 4px;
    position: relative;
    display: inline-block;
    margin: 0 10px;
}

body.dark-mode .mini-rack {
    background: linear-gradient(to bottom, var(--bg-elevated), var(--bg-card));
    border-color: var(--border-color);
}

.mini-rack-point {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid white;
}

.search-highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
}

body.dark-mode .search-highlight {
    background-color: rgba(245, 158, 11, 0.3);
}

.group-header {
    background: linear-gradient(to right, #e9ecef, transparent);
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 10px;
}

body.dark-mode .group-header {
    background: linear-gradient(to right, var(--bg-elevated), transparent);
}

/* ========================================
   INVMAN.HTML - Inventory Manager
   ======================================== */
.low-stock {
    background-color: #fff3cd;
}

body.dark-mode .low-stock {
    background-color: rgba(245, 158, 11, 0.15);
}

.out-of-stock {
    background-color: #f8d7da;
}

body.dark-mode .out-of-stock {
    background-color: rgba(239, 68, 68, 0.15);
}

.quantity-badge {
    font-size: 1.1rem;
    padding: 0.5rem 0.75rem;
}

/* Inventory card wrapper - matches tool-card pattern from index.html */
.inventory-card-wrapper {
    display: block;
    height: 100%;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    border-radius: 12px;
}

.inventory-card-wrapper:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.dark-mode .inventory-card-wrapper:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Inventory card inside wrapper */
.inventory-card-wrapper .card {
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
}

/* Fix inventory card text in dark mode */
.inventory-card-wrapper .card-title,
.inventory-card-wrapper .fw-bold,
.inventory-card-wrapper .h4 {
    color: var(--text-primary) !important;
}

.inventory-card-wrapper .text-muted {
    color: var(--text-secondary) !important;
}

/* ========================================
   COOLMAN.HTML - Cooling Manager
   ======================================== */

/* Fix coolman stat cards */
.coolman-stats .card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
}

.coolman-stats .text-muted {
    color: var(--text-secondary) !important;
}

.coolman-stats .h3,
.coolman-stats .fw-bold {
    color: var(--text-primary) !important;
}

/* ========================================
   SHARED UTILITY CLASSES
   ======================================== */
.bg-success {
    background-color: #08c517 !important;
}

/* Smooth transitions for theme switching */
.card,
.modal-content,
.form-control,
.form-select,
.dropdown-menu,
.list-group-item,
.table {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Header styling consistency */
.card.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.card.shadow {
    box-shadow: var(--shadow-md);
}

body.dark-mode .shadow,
body.dark-mode .shadow-sm,
body.dark-mode .shadow-lg {
    box-shadow: var(--shadow-md) !important;
}

/* ========================================
   ACCESSIBILITY - Focus Indicators
   ======================================== */

/* Remove default focus outline (only show :focus-visible) */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Default focus - remove outline */
*:focus-visible {
    outline: none;
}

/* Text inputs and textareas ONLY - Brighter, more visible glow */
input[type="text"]:focus-visible,
input[type="search"]:focus-visible,
input[type="email"]:focus-visible,
input[type="password"]:focus-visible,
input[type="number"]:focus-visible,
input[type="url"]:focus-visible,
input[type="tel"]:focus-visible,
textarea:focus-visible,
input[type="text"].form-control:focus-visible,
input[type="search"].form-control:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.5), 0 0 8px 3px rgba(147, 51, 234, 0.4) !important;
    border-radius: 0.375rem !important; /* Preserve rounded corners */
}

body.dark-mode input[type="text"]:focus-visible,
body.dark-mode input[type="search"]:focus-visible,
body.dark-mode input[type="email"]:focus-visible,
body.dark-mode input[type="password"]:focus-visible,
body.dark-mode input[type="number"]:focus-visible,
body.dark-mode input[type="url"]:focus-visible,
body.dark-mode input[type="tel"]:focus-visible,
body.dark-mode textarea:focus-visible,
body.dark-mode input[type="text"].form-control:focus-visible,
body.dark-mode input[type="search"].form-control:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.6), 0 0 8px 3px rgba(192, 132, 252, 0.5) !important;
    border-radius: 0.375rem !important;
}

/* Selects and dropdowns - Softer glow (but still visible) */
select:focus-visible,
.form-select:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.35), 0 0 6px 2px rgba(147, 51, 234, 0.25) !important;
}

body.dark-mode select:focus-visible,
body.dark-mode .form-select:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.45), 0 0 6px 2px rgba(192, 132, 252, 0.35) !important;
}

/* Buttons, links, cards - Even softer glow */
button:focus-visible,
a:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.card:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.3), 0 0 5px 1px rgba(147, 51, 234, 0.2) !important;
}

body.dark-mode button:focus-visible,
body.dark-mode a:focus-visible,
body.dark-mode .btn:focus-visible,
body.dark-mode .nav-link:focus-visible,
body.dark-mode .dropdown-item:focus-visible,
body.dark-mode .card:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.4), 0 0 5px 1px rgba(192, 132, 252, 0.3) !important;
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

/* Respect user's reduced motion preference - disable all transitions and animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Specifically disable hover transforms */
    .tool-card:hover,
    .inventory-card-wrapper:hover {
        transform: none !important;
    }

    /* Disable rack slot transforms */
    .rack-u-slot:hover,
    .rack-u-slot.selected {
        transform: none !important;
    }

    /* Disable pathway option transforms */
    .pathway-option:hover,
    .pathway-option.selected {
        transform: none !important;
    }
}
