@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@300;400;500;600;700&display=swap');

/* ==================== SEMESTRA ARENA - COMMON STYLES ==================== */

/* --- Base Styles --- */
body {
    padding-top: 76px; /* Space for fixed navbar */
}

/* --- Dark Theme Variables --- */
[data-bs-theme=dark] {
    color-scheme: dark;
    --bs-body-color: rgba(255, 255, 255, 0.85);
    --bs-body-bg: #1d2835;
    --bs-heading-color: #fff;
    --bs-link-color: #0fdb77;
    --bs-link-hover-color: #46df94;
    --bs-card-bg: #28292b;
    --bs-border-color: rgba(255, 255, 255, 0.25);
    --bs-inverse-rgb: 255, 255, 255;
    --bs-theme-rgb: 15, 219, 119;
    --bs-theme-color: #0fdb77;

    /* Semestra Arena Custom Colors */
    --arena-primary: #0fdb77;
    --arena-secondary: #46df94;
    --arena-dark: #1d2835;
    --arena-darker: #151d28;
    --arena-card: #28292b;
    --arena-border: rgba(255, 255, 255, 0.25);

    /* Team Colors */
    --team-red: #e74c3c;
    --team-blue: #3498db;
    --team-purple: #9b59b6;
    --team-black: #34495e;

    /* Severity Colors */
    --severity-critical: #e74c3c;
    --severity-high: #e67e22;
    --severity-medium: #f39c12;
    --severity-low: #3498db;
    --severity-info: #95a5a6;

    /* Status Colors */
    --status-success: #2ecc71;
    --status-warning: #f39c12;
    --status-danger: #e74c3c;
    --status-info: #3498db;
}

/* --- Base Styles --- */
html {
    background-color: var(--bs-body-bg);
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: "Chakra Petch", sans-serif;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--arena-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--arena-secondary);
}

/* --- Typography --- */
.text-theme {
    color: var(--arena-primary) !important;
}

.text-white {
    color: #fff !important;
}

.text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

.fw-500 {
    font-weight: 500 !important;
}

.fw-600 {
    font-weight: 600 !important;
}

.fs-12px {
    font-size: 12px !important;
}

.fs-14px {
    font-size: 14px !important;
}

.fs-24px {
    font-size: 24px !important;
}

/* --- Cards --- */
.card {
    position: relative;
    border: 1px solid var(--arena-border);
    background-color: var(--arena-card);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--arena-primary);
    box-shadow: 0 0 20px rgba(15, 219, 119, 0.1);
}

.card-header {
    background-color: rgba(15, 219, 119, 0.1);
    border-bottom: 1px solid var(--arena-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    flex: 1 1 auto;
    padding: 1.25rem;
    color: var(--bs-body-color);
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--arena-border);
    padding: 0.75rem 1.25rem;
}

/* --- Tables --- */
.table {
    --bs-table-bg: transparent;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table-dark {
    --bs-table-bg: var(--arena-darker);
    --bs-table-striped-bg: rgba(81, 81, 81, 0.2);
    --bs-table-hover-bg: rgba(15, 219, 119, 0.1);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(81, 81, 81, 0.2);
}

.table > :not(caption) > * > * {
    padding: 0.75rem;
    border-bottom: 1px solid var(--arena-border);
}

.table thead th {
    background-color: rgba(15, 219, 119, 0.15);
    border-bottom: 2px solid var(--arena-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

table tr th:first-child {
    border-top-left-radius: 8px;
}

table tr th:last-child {
    border-top-right-radius: 8px;
}

table tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

table tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* --- Buttons --- */
.btn-theme {
    background-color: var(--arena-primary);
    border-color: var(--arena-primary);
    color: #000;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-theme:hover {
    background-color: var(--arena-secondary);
    border-color: var(--arena-secondary);
    color: #000;
    box-shadow: 0 0 15px rgba(15, 219, 119, 0.5);
}

.btn-outline-theme {
    border-color: var(--arena-primary);
    color: var(--arena-primary);
    background: transparent;
}

.btn-outline-theme:hover {
    background-color: var(--arena-primary);
    border-color: var(--arena-primary);
    color: #000;
}

/* Team Color Buttons */
.btn-red-team {
    background-color: var(--team-red);
    border-color: var(--team-red);
    color: #fff;
}

.btn-blue-team {
    background-color: var(--team-blue);
    border-color: var(--team-blue);
    color: #fff;
}

.btn-purple-team {
    background-color: var(--team-purple);
    border-color: var(--team-purple);
    color: #fff;
}

/* --- Badges --- */
.badge-theme {
    background-color: var(--arena-primary);
    color: #000;
    font-weight: 600;
}

.badge-critical {
    background-color: var(--severity-critical);
    color: #fff;
}

.badge-high {
    background-color: var(--severity-high);
    color: #fff;
}

.badge-medium {
    background-color: var(--severity-medium);
    color: #000;
}

.badge-low {
    background-color: var(--severity-low);
    color: #fff;
}

/* Team Badges */
.badge-red-team {
    background-color: var(--team-red);
    color: #fff;
}

.badge-blue-team {
    background-color: var(--team-blue);
    color: #fff;
}

.badge-purple-team {
    background-color: var(--team-purple);
    color: #fff;
}

.badge-black-team {
    background-color: var(--team-black);
    color: #fff;
}

/* --- Progress Bars --- */
.progress {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    height: 1.5rem;
}

.progress-bar-theme {
    background-color: var(--arena-primary);
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

/* --- List Groups --- */
.list-group-item {
    background-color: transparent;
    border: 1px solid var(--arena-border);
    color: var(--bs-body-color);
}

.list-group-item:hover {
    background-color: rgba(15, 219, 119, 0.1);
}

.list-group-item.active {
    background-color: var(--arena-primary);
    border-color: var(--arena-primary);
    color: #000;
    font-weight: 600;
}

/* --- Forms --- */
.form-control,
.form-select {
    background-color: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

.form-control:focus,
.form-select:focus {
    background-color: #1a1f2e;
    border-color: var(--arena-primary);
    box-shadow: 0 0 0 0.25rem rgba(15, 219, 119, 0.25);
    color: #e0e0e0;
}

/* Dropdown/Select specific styles */
.form-select option {
    background-color: #1a1f2e;
    color: #e0e0e0;
}

/* Disabled state */
.form-control:disabled,
.form-select:disabled {
    background-color: rgba(255, 255, 255, 0.03);
    opacity: 0.6;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Input groups */
.input-group-text {
    background-color: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* --- Alerts --- */
.alert-theme {
    background-color: rgba(15, 219, 119, 0.15);
    border-color: var(--arena-primary);
    color: var(--arena-primary);
}

.alert-critical {
    background-color: rgba(231, 76, 60, 0.15);
    border-color: var(--severity-critical);
    color: var(--severity-critical);
}

.alert-high {
    background-color: rgba(230, 126, 34, 0.15);
    border-color: var(--severity-high);
    color: var(--severity-high);
}

.alert-medium {
    background-color: rgba(243, 156, 18, 0.15);
    border-color: var(--severity-medium);
    color: var(--severity-medium);
}

/* --- Navigation --- */
.navbar {
    background-color: var(--arena-darker) !important;
    border-bottom: 2px solid var(--arena-primary);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--arena-primary) !important;
}

.navbar-brand:hover {
    color: var(--arena-secondary) !important;
}

.nav-link {
    color: rgba(255, 255, 255, 0.75) !important;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--arena-primary) !important;
}

.nav-link.active {
    color: var(--arena-primary) !important;
    font-weight: 600;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 76px;
    left: 0;
    width: 250px;
    height: calc(100vh - 76px);
    background-color: var(--arena-darker);
    border-right: 1px solid var(--arena-border);
    overflow-y: auto;
    z-index: 1000;
    padding: 1.5rem 0;
}

/* Main content area (for pages with sidebar) */
.main-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: calc(100vh - 76px);
}

.sidebar .nav-link {
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.75);
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(15, 219, 119, 0.1);
    border-left-color: var(--arena-primary);
    color: var(--arena-primary);
}

.sidebar .nav-link.active {
    background-color: rgba(15, 219, 119, 0.15);
    border-left-color: var(--arena-primary);
    color: var(--arena-primary);
    font-weight: 600;
}

.sidebar .nav-section-title {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1rem;
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

/* Expandable menu items */
.sidebar .nav-expandable {
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .nav-expandable .chevron {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    margin-left: auto;
}

.sidebar .nav-expandable.expanded .chevron {
    transform: rotate(90deg);
}

.sidebar .nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar .nav-submenu.show {
    max-height: 500px;
}

.sidebar .nav-submenu .nav-link {
    padding-left: 3rem;
    font-size: 0.9rem;
}

.sidebar .nav-submenu .nav-link i {
    font-size: 0.85rem;
}

/* --- Metric Cards --- */
.metric-card {
    background: linear-gradient(135deg, rgba(15, 219, 119, 0.1) 0%, transparent 100%);
    border: 1px solid var(--arena-border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: var(--arena-primary);
    box-shadow: 0 0 25px rgba(15, 219, 119, 0.15);
    transform: translateY(-2px);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--arena-primary);
    line-height: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.metric-trend {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.metric-trend.up {
    color: var(--status-success);
}

.metric-trend.down {
    color: var(--status-danger);
}

/* --- Status Indicators --- */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.online {
    background-color: var(--status-success);
    box-shadow: 0 0 8px var(--status-success);
}

.status-dot.offline {
    background-color: var(--status-danger);
}

.status-dot.warning {
    background-color: var(--status-warning);
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--arena-primary), transparent);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.4rem;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--arena-primary);
    border: 2px solid var(--arena-darker);
}

.timeline-content {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--arena-primary);
}

/* --- Loading Spinner --- */
.spinner-theme {
    border: 3px solid rgba(15, 219, 119, 0.2);
    border-top-color: var(--arena-primary);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(15, 219, 119, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--arena-primary);
}

/* --- Utilities --- */
.bg-darker {
    background-color: var(--arena-darker) !important;
}

.bg-card {
    background-color: var(--arena-card) !important;
}

.border-theme {
    border-color: var(--arena-primary) !important;
}

.glow {
    box-shadow: 0 0 20px rgba(15, 219, 119, 0.3);
}

.glow-hover:hover {
    box-shadow: 0 0 25px rgba(15, 219, 119, 0.5);
    transition: box-shadow 0.3s ease;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-in-up {
    animation: slideInUp 0.5s ease;
}

.pulse {
    animation: pulse 2s ease infinite;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        min-height: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .metric-value {
        font-size: 2rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }
}

/* --- Code Blocks --- */
pre {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--arena-border);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
}

code {
    color: var(--arena-primary);
    background-color: rgba(15, 219, 119, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875em;
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* --- Tooltips --- */
.tooltip-inner {
    background-color: var(--arena-primary);
    color: #000;
    font-weight: 500;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--arena-primary);
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: var(--arena-primary);
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: var(--arena-primary);
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: var(--arena-primary);
}
