/**
 * TM Webpanel - Base Styles
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: var(--tm-font-primary);
    font-size: 14px;
    line-height: 1.5;
    color: var(--tm-text-primary);
    background: var(--tm-bg-primary);
    overflow: hidden;
}

a {
    color: var(--tm-accent);
    text-decoration: none;
    transition: color var(--tm-transition-fast);
}

a:hover {
    color: var(--tm-accent-light);
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: var(--tm-bg-tertiary);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-border-radius-sm);
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color var(--tm-transition-fast), box-shadow var(--tm-transition-fast);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--tm-accent);
    box-shadow: 0 0 0 2px rgba(201, 167, 108, 0.2);
}

input::placeholder {
    color: var(--tm-text-muted);
}

/* App Layout */
#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--tm-sidebar-width);
    background: var(--tm-bg-secondary);
    border-right: 1px solid var(--tm-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--tm-transition-slow);
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--tm-border);
}

.sidebar-logo {
    font-family: var(--tm-font-display);
    font-size: 1.25rem;
    color: var(--tm-accent);
    letter-spacing: 2px;
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--tm-text-secondary);
    transition: all var(--tm-transition-fast);
}

.nav-item:hover {
    background: var(--tm-bg-hover);
    color: var(--tm-text-primary);
}

.nav-item.active {
    background: rgba(201, 167, 108, 0.1);
    color: var(--tm-accent);
    border-right: 3px solid var(--tm-accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.nav-divider {
    height: 1px;
    background: var(--tm-border);
    margin: 0.5rem 1rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--tm-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    overflow: hidden;
}

.user-name {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--tm-text-secondary);
}

.logout-btn {
    padding: 0.5rem;
    border-radius: var(--tm-border-radius-sm);
    color: var(--tm-text-secondary);
    transition: all var(--tm-transition-fast);
}

.logout-btn:hover {
    background: var(--tm-bg-hover);
    color: var(--tm-error);
}

.logout-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    height: var(--tm-header-height);
    background: var(--tm-bg-secondary);
    border-bottom: 1px solid var(--tm-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    padding: 0.5rem;
    border-radius: var(--tm-border-radius-sm);
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--tm-success-bg);
    border-radius: 20px;
    color: var(--tm-success);
    font-size: 0.875rem;
}

.online-indicator .dot {
    width: 8px;
    height: 8px;
    background: var(--tm-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Page Content */
.page-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--tm-text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tm-border);
    border-top-color: var(--tm-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 49;
    }

    .sidebar-overlay.active {
        display: block;
    }
}
