/* ============================================================
   PLUGINATE ÜHINE CSS — VAJEKUJUNDUS (HELE)
   ============================================================
   See fail stiilib kõiki ühiseid klasse, mida pluginad kasutavad:
   - Tabelid (.table, .table-striped, .table-hover, .table-dark)
   - Vormid (.form-control, .form-select)
   - Nupud (.btn, .btn-primary, .btn-outline-*)
   - Märgised (.badge, .bg-*)
   - Kaardid (.card)
   - Teated (.alert)
   - Rippmenüüd (.dropdown-menu, .dropdown-item)
   - Modaalid (.modal-*)
   - Boilerweb-seadmed spetsiifilised (.bin-btn, .bin-dot, .swipe-hint)
   ============================================================ */

/* ============ TABELID ============ */
.table {
    --bs-table-bg: #fff;
    --bs-table-color: #333;
    --bs-table-border-color: #e0e6ed;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-striped-color: #333;
    --bs-table-hover-bg: #eaf4fc;
    --bs-table-hover-color: #1a2332;
    color: #333;
    border-color: #e0e6ed;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.85rem 1rem;
    border-bottom-width: 1px;
    background-color: transparent;
    color: inherit;
}

.table thead.table-dark,
.table > thead.table-dark {
    --bs-table-bg: #1a2332;
    --bs-table-color: #fff;
    --bs-table-border-color: #2c3e50;
}

.table thead.table-dark th {
    background: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 3px solid #3498db;
    padding: 1rem;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #f8fafc;
    background-color: #f8fafc;
    color: #333;
    box-shadow: none;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #eaf4fc;
    background-color: #eaf4fc;
    color: #1a2332;
}

.table-responsive {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e0e6ed;
}

.device-row {
    transition: all 0.2s ease;
}

.device-row:hover {
    transform: translateX(2px);
}

/* ============ VORMI ELEMENDID ============ */
.form-control,
.form-select {
    background-color: #fff;
    color: #333;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    transition: all 0.25s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    color: #333;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-control::placeholder {
    color: #94a3b8;
    opacity: 1;
}

#devicesSearchInput {
    border: 2px solid #e0e6ed;
    background-color: #fff;
    color: #333;
}

#devicesSearchInput:focus {
    border-color: #3498db;
    background-color: #fff;
    color: #333;
}

/* ============ NUPUD ============ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.25s ease;
    border-width: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    border: none;
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #2c80b8 0%, #1a2332 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.35);
    color: #fff;
}

.btn-outline-primary {
    color: #3498db;
    border-color: #3498db;
    background: transparent;
}

.btn-outline-primary:hover {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
}

.btn-outline-secondary {
    color: #64748b;
    border-color: #cbd5e1;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #64748b;
    border-color: #64748b;
    color: #fff;
}

.btn-danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.btn-success {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #1e8449;
    border-color: #1e8449;
    color: #fff;
}

.btn-warning {
    background: #f39c12;
    border-color: #f39c12;
    color: #fff;
}

.btn-warning:hover {
    background: #d68910;
    border-color: #d68910;
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1.05rem;
    border-radius: 10px;
}

/* ============ MÄRGISED ============ */
.badge {
    font-weight: 600;
    padding: 0.4em 0.7em;
    border-radius: 6px;
    font-size: 0.8em;
}

.badge.bg-light {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e0e6ed;
}

.badge.bg-primary {
    background-color: #3498db !important;
    color: #fff !important;
}

.badge.bg-success {
    background-color: #27ae60 !important;
    color: #fff !important;
}

.badge.bg-danger {
    background-color: #e74c3c !important;
    color: #fff !important;
}

.badge.bg-warning {
    background-color: #f39c12 !important;
    color: #fff !important;
}

.badge.bg-secondary {
    background-color: #64748b !important;
    color: #fff !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
    color: #fff !important;
}

/* ============ KAARDID ============ */
.card {
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    color: #333;
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #eaf4fc 100%);
    border-bottom: 2px solid #e0e6ed;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.5rem;
    color: #1a2332;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
    color: #333;
}

.card-footer {
    background: #f8fafc;
    border-top: 1px solid #e0e6ed;
    padding: 1rem 1.5rem;
}

/* ============ TEATED ============ */
.alert {
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alert-info {
    background: #eaf4fc;
    color: #1c6a9a;
    border-color: #bee0f5;
}

.alert-success {
    background: #e8f8f0;
    color: #1e8449;
    border-color: #b8e6cc;
}

.alert-danger {
    background: #fdedec;
    color: #b03a2e;
    border-color: #f5b7b1;
}

.alert-warning {
    background: #fef5e7;
    color: #9a6400;
    border-color: #fad7a0;
}

/* ============ RIPPMENÜÜD ============ */
.dropdown-menu {
    background: #1a2332;
    border: 1px solid #2c3e50;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 0;
}

.dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.55rem 1.25rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #2c3e50;
    color: #fff;
}

.dropdown-divider {
    border-color: #2c3e50;
    margin: 0.25rem 0;
}

.dropdown-item-text {
    color: #fff !important;
}

/* ============ MODAALID ============ */
.modal-content {
    background: #fff;
    color: #333;
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-header {
    background: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%);
    color: #fff;
    border-bottom: 3px solid #3498db;
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-title {
    color: #fff;
    font-weight: 600;
}

.modal-body {
    background: #fff;
    color: #333;
    padding: 1.75rem;
}

.modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e0e6ed;
    padding: 1rem 1.5rem;
}

/* ============ BOILERWEB-SEADMED: KASTINUPUD ============ */
.bin-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.bin-btn:hover {
    border-color: #3498db;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.bin-btn.active {
    border-color: #3498db;
    background: linear-gradient(135deg, #eaf4fc 0%, #d6eaf8 100%);
    color: #1a2332;
    box-shadow: 0 4px 14px rgba(52, 152, 219, 0.25);
}

.bin-btn .badge {
    background: #e0e6ed !important;
    color: #334155 !important;
    font-size: 0.75rem;
    padding: 0.25em 0.6em;
}

.bin-btn.active .badge {
    background: #3498db !important;
    color: #fff !important;
}

/* Kastide täpid */
.bin-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.red-dot {
    background: linear-gradient(135deg, #ff6b6b 0%, #e74c3c 100%);
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.5);
}

.yellow-dot {
    background: linear-gradient(135deg, #f7dc6f 0%, #f39c12 100%);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}

.green-dot {
    background: linear-gradient(135deg, #58d68d 0%, #27ae60 100%);
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.5);
}

.all-dot {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
}

/* ============ BOILERWEB-SEADMED: SWIPE HINT ============ */
.swipe-hint {
    margin-top: 1.5rem;
    padding: 0.85rem 1.25rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
}

.swipe-hint i {
    color: #3498db;
    margin-right: 0.5rem;
}

/* ============ BOILERWEB-SEADMED: ALARM BADGE ============ */
.alarm-badge {
    animation: pulse-alarm 1.5s ease-in-out infinite;
    font-size: 0.95rem;
    padding: 0.4em 0.7em;
}

@keyframes pulse-alarm {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(231, 76, 60, 0);
    }
}

/* ============ LISAD ============ */
.text-muted {
    color: #64748b !important;
}

.fst-italic {
    font-style: italic;
}

.small {
    font-size: 0.85rem;
}

hr {
    border-color: #e0e6ed;
    opacity: 1;
}

code {
    background: #f1f5f9;
    color: #e74c3c;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}