/* OctoOps - Custom Styles */

/* Sidebar */
.sidebar {
    width: 220px;
    min-height: calc(100vh - 56px);
    background-color: #1a1d21;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid #2c3034;
}

/* Sidebar navigation links */
.sidebar-link {
    color: #adb5bd !important;
    border-radius: 0 !important;
    padding: 0.65rem 1.25rem !important;
    font-size: 0.9rem;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.sidebar-link:hover {
    color: #ffffff !important;
    background-color: #2c3034 !important;
}

.sidebar-link.active {
    color: #ffffff !important;
    background-color: #0d6efd !important;
}

.sidebar-link i {
    font-size: 1rem;
}

/* Sidebar category labels */
.sidebar-category {
    color: #8a9099;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 1rem 1.25rem 0.35rem;
    list-style: none;
    border-top: 1px solid #2c3034;
    margin-top: 0.25rem;
}

.sidebar-category:first-child {
    border-top: none;
    margin-top: 0;
}

/* Sidebar footer */
.sidebar-footer {
    color: #6c757d;
    font-size: 0.75rem;
}

/* Main content area - offset by sidebar width */
.main-content {
    margin-left: 220px;
    min-height: calc(100vh - 56px);
    background-color: #f8f9fa;
    overflow-x: hidden;
    max-width: calc(100vw - 220px);
}

/* Provider dropdown styling in navbar */
#providerSelect {
    font-size: 0.85rem;
}

#providerSelect option {
    background-color: #343a40;
    color: #f8f9fa;
}

/* Badge in sidebar */
#callbackBadge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Page headings */
.page-heading {
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 991.98px) {
    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #2c3034;
    }

    .sidebar .nav {
        flex-direction: row !important;
        flex-wrap: wrap;
        padding: 0.5rem !important;
    }

    .sidebar .nav-item {
        margin-top: 0 !important;
    }

    .sidebar-link {
        padding: 0.5rem 0.75rem !important;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
}

/* ========== Log Viewer ========== */
.log-viewer-container {
    display: flex;
    gap: 0;
    height: calc(100vh - 150px);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.log-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dee2e6;
    min-width: 0;
}

.log-panel:last-child {
    border-right: none;
}

.log-panel-apis {
    width: 300px;
    flex-shrink: 0;
}

.log-panel-files {
    width: 320px;
    flex-shrink: 0;
}

.log-panel-content {
    flex: 1;
    min-width: 0;
}

.log-panel-header {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    background: #f0f1f3;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.log-panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 4px;
}

/* API Group */
.api-group-header {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    user-select: none;
}

.api-group-header:hover {
    color: #495057;
}

.api-list-item {
    display: flex;
    align-items: center;
    padding: 5px 8px 5px 20px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
}

.api-list-item:hover {
    background: #e9ecef;
}

.api-list-item.active {
    background: #0d6efd;
    color: #fff;
}

/* File List */
.file-list-item {
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    border-bottom: 1px solid #f0f1f3;
}

.file-list-item:hover {
    background: #e9ecef;
}

.file-list-item.active {
    background: #cfe2ff;
    border-color: #b6d4fe;
}

.file-name {
    font-size: 0.8rem;
    font-weight: 500;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 2px;
}

/* Log Content */
.log-content-wrapper {
    flex: 1;
    overflow: auto;
    background: #1e1e1e;
}

.log-content {
    margin: 0;
    padding: 12px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #d4d4d4;
    background: #1e1e1e;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 100%;
}

/* Log Level Colors */
.log-line {
    padding: 0 4px;
}

.log-content .log-line-err {
    color: #f48771 !important;
    background: rgba(244, 135, 113, 0.08);
}

.log-content .log-line-wrn {
    color: #cca700 !important;
    background: rgba(204, 167, 0, 0.06);
}

.log-content .log-line-inf {
    color: #89d185 !important;
}

.log-content .log-line-dbg {
    color: #808080 !important;
}

.log-content mark {
    background: #e2c08d;
    color: #1e1e1e;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Level filter button sizes */
.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
}

/* ========== Log Viewer — Structured View ========== */

.log-structured-view {
    flex: 1;
    overflow: auto;
    background: #1e1e1e;
    min-height: 100%;
}

.log-struct-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: #d4d4d4;
    table-layout: fixed;
}

/* Column widths via th — table-layout:fixed picks these up */
.log-struct-table thead th:nth-child(1) { width: 96px;  }  /* Time */
.log-struct-table thead th:nth-child(2) { width: 52px;  }  /* Level */
.log-struct-table thead th:nth-child(3) { width: 170px; }  /* Source */
/* Message (col 4) gets remaining width automatically */

.log-struct-table thead th {
    padding: 5px 6px;
    background: #252526;
    color: #858585;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid #3c3c3c;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
}

.log-struct-row td {
    padding: 3px 6px;
    border-bottom: 1px solid #2a2a2a;
    vertical-align: top;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-struct-row:hover td { background: #2a2d2e; }
.log-struct-row.has-detail:hover td { background: #2d3033; }

.log-struct-err td:first-child { border-left: 3px solid #f48771; }
.log-struct-wrn td:first-child { border-left: 3px solid #cca700; }
.log-struct-inf td:first-child { border-left: 3px solid #89d185; }
.log-struct-dbg td:first-child { border-left: 3px solid #808080; }

.log-struct-time {
    color: #858585;
    font-size: 0.74rem;
}

.log-struct-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.log-struct-badge-err { background: #5a1d1d; color: #f48771 !important; }
.log-struct-badge-wrn { background: #4a3800; color: #cca700 !important; }
.log-struct-badge-inf { background: #1e3a20; color: #89d185 !important; }
.log-struct-badge-dbg { background: #2a2a2a; color: #808080 !important; }

.log-struct-source {
    color: #9cdcfe;
    font-size: 0.74rem;
    cursor: default;
}

.log-struct-message {
    white-space: normal;
    word-break: break-word;
    color: #d4d4d4;
    max-width: 0;
}

.struct-chevron {
    font-size: 0.65rem;
    color: #858585;
    vertical-align: middle;
}

.log-struct-detail td {
    padding: 0;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
}

.log-struct-continuation {
    margin: 0;
    padding: 8px 12px 8px 24px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    color: #ce9178;
    background: transparent;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.45;
    max-height: 300px;
    overflow-y: auto;
}

.log-struct-table mark {
    background: #e2c08d;
    color: #1e1e1e;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Log Viewer — Content panel fullscreen mode */
.log-panel-content.log-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1050;
    border-radius: 0;
    border: none;
}

/* Responsive: stack log panels on small screens */
@media (max-width: 991.98px) {
    .log-viewer-container {
        flex-direction: column;
        height: auto;
    }

    .log-panel-apis,
    .log-panel-files {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .log-content-wrapper {
        min-height: 400px;
    }
}

/* ========== Mobile Simulator ========== */

/* Phone frame - the dark bezel */
.phone-frame {
    width: 375px !important;
    height: 740px !important;
    min-width: 375px;
    min-height: 740px;
    max-width: 375px;
    max-height: 740px;
    background: #111111 !important;
    border-radius: 44px;
    border: 3px solid #222;
    box-shadow:
        inset 0 0 0 2px #333,
        0 0 0 1px #000,
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    padding: 14px 12px;
    box-sizing: border-box !important;
}

/* Notch at top of screen */
.phone-notch {
    width: 130px;
    height: 30px;
    background: #111111;
    border-radius: 0 0 18px 18px;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
}

.phone-notch-camera {
    width: 12px;
    height: 12px;
    background: #1a1a2e;
    border-radius: 50%;
    border: 2px solid #2a2a3a;
    box-shadow: inset 0 0 2px rgba(0, 0, 255, 0.2);
}

/* Phone screen - the white inner area */
.phone-screen {
    width: 100% !important;
    height: 100% !important;
    background: #f5f5f5 !important;
    border-radius: 32px;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Side buttons on phone edges */
.phone-side-btn {
    position: absolute;
    width: 4px;
    background: linear-gradient(to right, #222, #444, #222);
    border-radius: 2px;
}

.phone-btn-vol-up {
    right: -7px;
    top: 140px;
    height: 40px;
}

.phone-btn-vol-down {
    right: -7px;
    top: 195px;
    height: 40px;
}

.phone-btn-power {
    left: -7px;
    top: 170px;
    height: 55px;
}

/* Phone screen content sections */
.phone-statusbar {
    height: 30px !important;
    min-height: 30px;
    background: #1a237e !important;
    color: white !important;
    font-size: 11px;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 16px;
    flex-shrink: 0;
}

.phone-appheader {
    background: #1a237e !important;
    color: white !important;
    padding: 8px 16px 12px;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.phone-device-info {
    background: #e8eaf6;
    padding: 6px 16px;
    font-size: 11px;
    color: #5c6bc0;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-content {
    flex: 1 1 0% !important;
    overflow-y: auto !important;
    padding: 8px;
    min-height: 0 !important;
}

/* Bottom navigation bar - MUST be horizontal */
.phone-bottomnav {
    height: 52px !important;
    min-height: 52px;
    background: white !important;
    border-top: 1px solid #e0e0e0;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
    flex-shrink: 0;
    padding: 0;
}

.phone-bottomnav > .phone-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center;
    font-size: 10px;
    color: #9e9e9e;
    cursor: pointer;
    padding: 4px 16px;
    transition: color 0.15s;
    flex: 1;
    text-align: center;
}

.phone-bottomnav > .phone-nav-item:hover {
    color: #1a237e;
}

.phone-bottomnav > .phone-nav-item.active {
    color: #1a237e;
    font-weight: 600;
}

.phone-bottomnav > .phone-nav-item i {
    font-size: 18px;
    display: block;
}

.phone-nav-label {
    margin-top: 2px;
    font-size: 10px;
}

/* Request cards inside phone */
.sim-request-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 3px solid #1a237e;
}

.sim-request-card.received {
    border-left-color: #1976d2;
}

.sim-request-card.completed {
    border-left-color: #2e7d32;
}

.sim-request-card.error {
    border-left-color: #c62828;
}

/* Approve / Reject buttons */
.sim-btn-approve {
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sim-btn-approve:hover {
    background: #1b5e20;
}

.sim-btn-reject {
    background: #c62828;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sim-btn-reject:hover {
    background: #b71c1c;
}

/* Connection dot */
.sim-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.sim-dot-on {
    background: #2e7d32;
    box-shadow: 0 0 4px rgba(46, 125, 50, 0.5);
}

.sim-dot-off {
    background: #c62828;
    box-shadow: 0 0 4px rgba(198, 40, 40, 0.3);
}
