/* BoxUpdater UI - Dashboard Layout */

/* Main layout structure */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 20px;
    background: var(--color-header);
    color: white;
    flex-shrink: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.navbar-brand img {
    height: 28px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-username {
    font-size: 14px;
    opacity: 0.9;
}

.navbar-logout {
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.navbar-logout:hover {
    background: rgba(255,255,255,0.25);
}

/* Main content wrapper */
.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--color-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.2s ease;
}

.sidebar.collapsed {
    width: 56px;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-toggle button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
}

.sidebar-toggle button:hover {
    color: white;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.menu-item.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--color-primary);
}

.menu-item-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-item-text {
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .menu-item-text {
    display: none;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px;
}

.menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 12px;
}

/* Content area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tab ribbon */
.tab-ribbon {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 20px;
    background: white;
    border-bottom: 1px solid var(--color-border);
    height: 42px;
    flex-shrink: 0;
}

.tab-ribbon.hidden {
    display: none;
}

.tab-item {
    padding: 10px 16px;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.tab-item:hover {
    color: var(--color-text);
}

.tab-item.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Content panels */
.content-panels {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* Panel header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h2 {
    margin: 0;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Stat cards */
.stat-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
}

.stat-card-label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text);
}

.stat-card-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Box list */
.box-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.box-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.box-item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.box-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.box-item-icon {
    width: 44px;
    height: 44px;
    background: var(--color-app-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.box-item-details h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
}

.box-item-details p {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.box-item-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.box-item-actions {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 130px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-app-bg);
}

/* Search bar */
.search-bar {
    position: relative;
    max-width: 300px;
}

.search-bar input {
    padding-left: 36px;
}

.search-bar-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Command panel */
.command-panel {
    background: #1E293B;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.command-input {
    display: flex;
    gap: 8px;
}

.command-input input {
    flex: 1;
    background: #0F172A;
    border: 1px solid #334155;
    color: #E2E8F0;
    font-family: inherit;
}

.command-input input:focus {
    border-color: var(--color-primary);
}

.command-output {
    margin-top: 12px;
    padding: 12px;
    background: #0F172A;
    border-radius: 4px;
    color: #94A3B8;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Login page specific */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-header) 0%, var(--color-sidebar) 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    margin: 0 0 8px 0;
    color: var(--color-header);
}

.login-header p {
    margin: 0;
    color: var(--color-text-muted);
}

.login-form .form-row {
    margin-bottom: 20px;
}

.login-form .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.login-error {
    background: #FEE2E2;
    color: #991B1B;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.login-error.show {
    display: block;
}

/* App list styles */
.app-tabs {
    display: flex;
    gap: 8px;
}

.app-list {
    max-height: 300px;
    overflow-y: auto;
}

.app-table {
    width: 100%;
    font-size: 13px;
}

.app-table th,
.app-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.app-table th {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 11px;
    text-transform: uppercase;
}

.app-name {
    font-weight: 500;
}

.app-package {
    font-size: 11px;
    word-break: break-all;
}

.app-actions {
    white-space: nowrap;
}

.app-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.app-actions .btn-warning {
    background: #FEF3C7;
    color: #92400E;
}
