/* CertsManager Global Styles */

/* ==========================================================================
   Filter Buttons (used in certificates, active connections, cameras, etc.)
   ========================================================================== */
.filter-buttons {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.filter-buttons .btn {
    margin: 2px 4px;
    border: 1px solid #ccc;
}

.filter-buttons .btn.active {
    box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
    font-weight: bold;
}

/* Tenant-specific button colors */
.filter-buttons .btn[data-filter="AWAAIT"],
.filter-buttons .btn[data-filter="project-awaait"] {
    background-color: #fff3d6;
    color: #8b6914;
}

.filter-buttons .btn[data-filter="FGC"],
.filter-buttons .btn[data-filter="project-fgc"] {
    background-color: #d6f5d6;
    color: #2d8a2d;
}

.filter-buttons .btn[data-filter="MTA_BUS"],
.filter-buttons .btn[data-filter="project-mta-bus"] {
    background-color: #edd6f5;
    color: #6b2d8a;
}

.filter-buttons .btn[data-filter="project-mta-metro"] {
    background-color: #d6eef5;
    color: #2c6e8a;
}

.filter-buttons .btn[data-filter="project-path"] {
    background-color: #f5e0d6;
    color: #8a4a2d;
}

/* ==========================================================================
   Severity Badges & Indicators
   ========================================================================== */
.severity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 500;
}

.badge-low { background-color: #fff3cd; color: #856404; }
.badge-medium { background-color: #ffe0b2; color: #c25e00; }
.badge-high { background-color: #ffccbc; color: #bf360c; }
.badge-critical { background-color: #e0e0e0; color: #555555; }

.duration-text {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9em;
}

.duration-low {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

.duration-medium {
    background-color: #ffe0b2 !important;
    color: #c25e00 !important;
}

.duration-high {
    background-color: #ffccbc !important;
    color: #bf360c !important;
}

.duration-critical {
    background-color: #e0e0e0 !important;
    color: #555555 !important;
}

/* Severity breakdown pills */
.severity-breakdown {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.severity-item {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 3px;
}

/* Warm warning gradient: cream → peach → coral → red */
.sev-critical { background: #e0e0e0; color: #555555; }
.sev-high { background: #ffccbc; color: #bf360c; }
.sev-medium { background: #ffe0b2; color: #c25e00; }
.sev-low { background: #fff3cd; color: #856404; }

/* ==========================================================================
   Tenant Badges
   ========================================================================== */
.tenant-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 500;
}

.tenant-fgc { background-color: #d6f5d6; color: #2d8a2d; }
.tenant-mta { background-color: #d6eef5; color: #2c6e8a; }
.tenant-awaait { background-color: #fff3d6; color: #8b6914; }
.tenant-path { background-color: #f5e0d6; color: #8a4a2d; }

/* ==========================================================================
   Dashboard Cards
   ========================================================================== */
.dashboard-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dashboard-card a {
    text-decoration: none;
    color: inherit;
}

.card-icon {
    font-size: 2.5em;
    opacity: 0.8;
}

.card-value {
    font-size: 2.2em;
    font-weight: 700;
    margin: 5px 0;
}

.card-label {
    font-size: 0.95em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Card color variants */
.card-issues { border-left: 4px solid #d9534f; }
.card-issues .card-icon { color: #d9534f; }
.card-issues.ok { border-left-color: #5cb85c; }
.card-issues.ok .card-icon { color: #5cb85c; }

.card-warnings { border-left: 4px solid #f0ad4e; }
.card-warnings .card-icon { color: #f0ad4e; }

.card-connections { border-left: 4px solid #5bc0de; }
.card-connections .card-icon { color: #5bc0de; }

.card-cameras { border-left: 4px solid #337ab7; }
.card-cameras .card-icon { color: #337ab7; }

.card-servers { border-left: 4px solid #5cb85c; }
.card-servers .card-icon { color: #5cb85c; }

.card-certificates { border-left: 4px solid #9b59b6; }
.card-certificates .card-icon { color: #9b59b6; }

/* ==========================================================================
   Dashboard Header & Refresh Status
   ========================================================================== */
.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.welcome-header h1 {
    margin: 0;
    font-size: 1.8em;
}

.refresh-status {
    font-size: 0.9em;
    color: #666;
}

.refresh-indicator {
    font-size: 1.4em;
    cursor: pointer;
    transition: color 0.3s, opacity 0.2s;
}

.refresh-indicator.active {
    color: #5cb85c;
    animation: pulse 2s infinite;
}

.refresh-indicator.paused {
    color: #f0ad4e;
    animation: none;
}

.refresh-indicator:hover {
    opacity: 0.7;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================================================
   No Results Message
   ========================================================================== */
.no-results {
    text-align: center;
    padding: 30px;
    color: #999;
    display: none;
}

/* ==========================================================================
   Recent Issues Table (Dashboard)
   ========================================================================== */
.recent-issues-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px;
    border-bottom: 2px solid #ddd;
    background-color: #f0f0f0;
    border-radius: 8px 8px 0 0;
}

.recent-issues-header strong {
    font-size: 1.15em;
    color: #333;
}

.recent-issues-header a {
    font-size: 0.9em;
    color: #337ab7;
    text-decoration: none;
    font-weight: 500;
}

.recent-issues-header a:hover {
    text-decoration: underline;
}

.recent-issues-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    table-layout: fixed;
}

.recent-issues-table thead th {
    background-color: #4a5568;
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    color: #fff;
    border-bottom: none;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

/* Fixed column widths for Recent Issues table */
.recent-issues-table thead th:nth-child(1) { width: 20%; }  /* Device */
.recent-issues-table thead th:nth-child(2) { width: 12%; }  /* Device ID */
.recent-issues-table thead th:nth-child(3) { width: 15%; }  /* Site */
.recent-issues-table thead th:nth-child(4) { width: 33%; }  /* Reason */
.recent-issues-table thead th:nth-child(5) { width: 20%; }  /* Duration */

.recent-issues-table tbody td {
    padding: 16px 18px;
    border-bottom: 1px solid #d0d0d0;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-issues-table tbody tr:hover {
    background-color: #f5f5f5;
}

.recent-issues-table tbody tr:last-child td {
    border-bottom: none;
}

.recent-issues-table a {
    color: #1a5fb4;
    text-decoration: none;
    font-weight: 500;
}

.recent-issues-table a:hover {
    text-decoration: underline;
    color: #0d3a7a;
}

.device-id-link {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95em;
    padding: 2px 6px;
    background-color: #f0f0f0;
    border-radius: 3px;
}

/* ==========================================================================
   Search Box
   ========================================================================== */
.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.search-box input:focus {
    border-color: #337ab7;
    outline: none;
    box-shadow: 0 0 5px rgba(51, 122, 183, 0.3);
}

/* ==========================================================================
   Auto-Refresh Controls
   ========================================================================== */
.refresh-controls {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.refresh-controls label {
    margin-right: 10px;
}

#countdown {
    font-weight: bold;
    color: #337ab7;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */
.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.6);
    padding: 8px;
    border-radius: 50%;
    z-index: 2;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Image Status Indicators
   ========================================================================== */
.has-image { color: #5cb85c; }
.no-image { color: #d9534f; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.welcome-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.version-footer {
    text-align: right;
    color: #999;
    font-size: 0.85em;
    margin-top: 20px;
}

/* ==========================================================================
   Responsive / Mobile
   ========================================================================== */
@media (max-width: 768px) {
    .dashboard-card {
        height: auto;
        min-height: 100px;
        padding: 15px;
    }
    
    .card-value { font-size: 1.8em; }
    .card-icon { font-size: 2em; }
    
    .hide-mobile { display: none; }
}
