/* ===========================================
   BUTTONS - Clean, Consistent Design System
   =========================================== */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    justify-content: center;
}

.btn .btn-icon {
    display: inline-flex;
    align-items: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

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

.btn-small {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.75rem;
}

.btn:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
    opacity: 0.85;
    cursor: not-allowed;
    transform: none !important;
}

/* ===========================================
   ICON BUTTONS - Unified Design
   =========================================== */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-600);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.icon-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.icon-btn:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.icon-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.08);
}

/* Icon sizing */
.icon-btn svg,
.icon-btn img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

/* Force SVGs to use currentColor */
.icon-btn svg {
    fill: currentColor;
    stroke: currentColor;
}

.icon-btn svg path,
.icon-btn svg circle,
.icon-btn svg rect,
.icon-btn svg line,
.icon-btn svg polyline,
.icon-btn svg polygon {
    fill: currentColor;
    stroke: currentColor;
}

/* Danger variant */
.icon-btn.danger {
    color: var(--error-color);
    border-color: #fecaca;
    background: var(--white);
}

.icon-btn.danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Disabled state */
.icon-btn:disabled,
.icon-btn[aria-disabled="true"] {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-400);
    opacity: 0.85;
    cursor: not-allowed;
    box-shadow: none;
}

/* ===========================================
   SIREN BUTTON STATES
   =========================================== */

/* Siren calm: all CTOs visible (green) */
.icon-btn.siren.calm,
.icon-btn.siren[data-state="calm"] {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.4);
    color: #16a34a;
}

.icon-btn.siren.calm:hover,
.icon-btn.siren[data-state="calm"]:hover {
    background: rgba(22, 163, 74, 0.15);
    border-color: rgba(22, 163, 74, 0.5);
}

/* Siren active/alert: filtering active (red) */
.icon-btn.siren.active,
.icon-btn.siren[data-state="alert"] {
    background: rgba(255, 59, 48, 0.12);
    border-color: rgba(255, 59, 48, 0.4);
    color: #ff3b30;
}

.icon-btn.siren.active:hover,
.icon-btn.siren[data-state="alert"]:hover {
    background: rgba(255, 59, 48, 0.18);
    border-color: rgba(255, 59, 48, 0.5);
}

.icon-btn.siren.active img,
.icon-btn.siren[data-state="alert"] img {
    filter: drop-shadow(0 0 3px rgba(255, 59, 48, 0.4));
}

/* Light mode emphasis to match dark mode siren contrast */
html[data-theme="light"] .icon-btn.siren.calm,
html[data-theme="light"] .icon-btn.siren[data-state="calm"] {
    border-width: 2px;
    border-color: rgba(22, 163, 74, 0.6);
    background: rgba(22, 163, 74, 0.14);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18), 0 2px 6px rgba(22, 163, 74, 0.15);
}

html[data-theme="light"] .icon-btn.siren.calm:hover,
html[data-theme="light"] .icon-btn.siren[data-state="calm"]:hover {
    border-color: rgba(22, 163, 74, 0.75);
    background: rgba(22, 163, 74, 0.2);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.24), 0 3px 8px rgba(22, 163, 74, 0.2);
}

html[data-theme="light"] .icon-btn.siren.active,
html[data-theme="light"] .icon-btn.siren[data-state="alert"] {
    border-width: 2px;
    border-color: rgba(255, 59, 48, 0.6);
    background: rgba(255, 59, 48, 0.16);
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.2), 0 2px 6px rgba(255, 59, 48, 0.18);
}

html[data-theme="light"] .icon-btn.siren.active:hover,
html[data-theme="light"] .icon-btn.siren[data-state="alert"]:hover {
    border-color: rgba(255, 59, 48, 0.8);
    background: rgba(255, 59, 48, 0.22);
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.26), 0 3px 8px rgba(255, 59, 48, 0.22);
}

/* Siren suppressed */
.icon-btn.siren.suppressed,
.icon-btn.siren[data-state="suppressed"] {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-400);
}

.icon-btn.siren.suppressed img,
.icon-btn.siren[data-state="suppressed"] img {
    filter: grayscale(1) opacity(0.6);
}

/* Collapse/expand accent */
.icon-btn.collapse,
.icon-btn.expand {
    color: #007AFF;
}

/* ===========================================
   DARK MODE - All Button Styles
   =========================================== */
html[data-theme="dark"] .btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

html[data-theme="dark"] .icon-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: none;
}

html[data-theme="dark"] .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .icon-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

html[data-theme="dark"] .icon-btn:disabled,
html[data-theme="dark"] .icon-btn[aria-disabled="true"] {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
    opacity: 1;
}

/* Dark mode collapse/expand variants */
html[data-theme="dark"] .icon-btn.collapse,
html[data-theme="dark"] .icon-btn.expand {
    color: rgba(255, 255, 255, 0.8);
}

html[data-theme="dark"] .icon-btn.collapse:hover,
html[data-theme="dark"] .icon-btn.expand:hover {
    color: rgba(255, 255, 255, 0.95);
}

/* Dark mode siren states - preserve white icons */
html[data-theme="dark"] .icon-btn.siren.calm,
html[data-theme="dark"] .icon-btn.siren[data-state="calm"] {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.35);
    color: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .icon-btn.siren.calm:hover,
html[data-theme="dark"] .icon-btn.siren[data-state="calm"]:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.45);
    color: #ffffff;
}

html[data-theme="dark"] .icon-btn.siren.active,
html[data-theme="dark"] .icon-btn.siren[data-state="alert"] {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.4);
    color: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .icon-btn.siren.active:hover,
html[data-theme="dark"] .icon-btn.siren[data-state="alert"]:hover {
    background: rgba(255, 59, 48, 0.25);
    border-color: rgba(255, 59, 48, 0.5);
    color: #ffffff;
}

html[data-theme="dark"] .icon-btn.siren.suppressed,
html[data-theme="dark"] .icon-btn.siren[data-state="suppressed"] {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
}

/* Dark mode danger */
html[data-theme="dark"] .icon-btn.danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

html[data-theme="dark"] .icon-btn.danger:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(255, 255, 255, 0.95);
}

/* ===========================================
   TOPOLOGY CONTENT AREA
   =========================================== */
.topology-content {
    flex: 1;
    position: relative;
    overflow: auto;
    padding: 0 var(--spacing-lg) var(--spacing-lg);
}
