/* ========================================
   The Dicktator Dashboard - Modern CSS
   ======================================== */

/* Base Styles */
:root {
    /* Grayscale Color Palette */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 80px;
    --border-radius: 8px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--gray-700);
    background-color: var(--gray-50);
    margin: 0;
    padding: 0;
}

/* Holy Grail Layout */
.holy-grail {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0.25rem 0 0 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.main-content .container-fluid {
    padding: 0;
}

.main-content .row {
    margin: 0;
    min-height: 100%;
}

/* Sidebars */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--gray-200);
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

/* Content Area */
.content {
    flex: 1;
    padding: 1.5rem;
    background: var(--gray-50);
    overflow-y: auto;
}

.content-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.section-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* System Card */
.system-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.system-card .card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
}

.system-card .card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.system-card .card-body {
    padding: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.status-healthy {
    color: var(--success);
}

/* Dropdown Styles */
.device-actions-menu {
    min-width: 200px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--gray-900);
}

.dropdown-item i {
    margin-right: 0.5rem;
    width: 1rem;
    text-align: center;
}

.dropdown-divider {
    margin: 0.25rem 0;
    border-color: var(--gray-200);
}

/* Devices Container */
.devices-container {
    padding: 1.5rem;
}

.device-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.device-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.device-card.active {
    border-left: 4px solid var(--success);
}

.device-card.inactive {
    border-left: 4px solid var(--gray-400);
}

.device-card.alarm {
    border-left: 4px solid var(--danger);
}

.device-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.device-header:hover {
    background-color: var(--gray-50);
}

.device-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.device-status {
    display: flex;
    gap: 0.5rem;
}

.device-details {
    flex: 1;
}

.device-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.25rem 0;
}

.device-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

.device-actions {
    display: flex;
    gap: 0.5rem;
}

/* Device Details Panel */
.device-details-panel {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.detail-group {
    margin-bottom: 1rem;
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-value {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-700);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.status-active {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.status-inactive {
    background-color: #f3f4f6;
    color: #6b7280;
}

.status-badge.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.status-acked {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-badge.status-completed {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.status-timeout {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.status-alarm {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Status Cards */
.status-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.status-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.status-icon.active {
    background-color: #dcfce7;
    color: #166534;
}

.status-icon.inactive {
    background-color: #f3f4f6;
    color: #6b7280;
}

.status-icon.alarm {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-info {
    flex: 1;
}

.status-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.status-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Table Styles */
.table {
    margin: 0;
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
    padding: 0.75rem;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* Form Styles */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button Styles */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-primary {
    background-color: var(--gray-700);
    border-color: var(--gray-700);
}

.btn-primary:hover {
    background-color: var(--gray-800);
    border-color: var(--gray-800);
}

.btn-outline-secondary {
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-outline-secondary:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 992px) {
    .holy-grail {
        flex-direction: column;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .sidebar-right {
        border-left: none;
        border-top: 1px solid var(--gray-200);
    }
    
    .content {
        padding: 1rem;
    }
    
    .devices-container {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .header-title {
        font-size: 1.5rem;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .device-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .device-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .device-actions {
        align-self: flex-end;
    }
    
    .status-cards {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .status-card {
        min-width: 200px;
    }
}

/* ========================================
   TAG FILTERING STYLES
   ======================================== */

.tag-filter-section {
    border-top: 1px solid var(--gray-200);
    padding-top: 1rem;
}

.tag-filter-container {
    position: relative;
}

.tag-input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 38px;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background-color: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tag-input-group:focus-within {
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
    background-color: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.tag-badge:hover {
    background-color: var(--gray-200);
}

.tag-badge .remove-tag {
    margin-left: 0.25rem;
    cursor: pointer;
    color: var(--gray-500);
    font-weight: bold;
    line-height: 1;
}

.tag-badge .remove-tag:hover {
    color: var(--danger);
}

.tag-search-input {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.875rem;
    padding: 0;
    margin: 0;
}

.tag-search-input:focus {
    box-shadow: none;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.tag-suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-700);
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tag-suggestion-item:hover {
    background-color: var(--gray-50);
}

.tag-suggestion-item.selected {
    background-color: var(--info);
    color: white;
}

.tag-suggestion-item .tag-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    background-color: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
}

.tag-suggestion-item.selected .tag-count {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.status-filter-container {
    margin-top: 1.5rem;
}

@media (min-width: 768px) {
    .status-filter-container {
        margin-top: 0;
    }
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 0.5rem;
}

/* Animation for tag badges */
.tag-badge {
    animation: tagBadgeIn 0.2s ease-out;
}

@keyframes tagBadgeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Utility Classes */
.text-muted {
    color: var(--gray-500) !important;
}

.bg-light {
    background-color: var(--gray-50) !important;
}

.border-light {
    border-color: var(--gray-200) !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--gray-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spin {
    animation: spin 1s linear infinite;
} 