/* PWA System Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --sidebar-bg: #0f172a;
    --sidebar-accent: #38bdf8;
    --sidebar-text: #e2e8f0;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --text-color: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background: #f5f5f5;
    line-height: 1.6;
}

body.app-layout-body {
    background: #eef2ff;
}

.app-layout {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.sidebar-user {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.sidebar-user strong,
.sidebar-user span {
    display: block;
}

.sidebar-user span {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-link,
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateX(2px);
}

.sidebar-link i,
.sidebar-logout i {
    width: 1.2rem;
    text-align: center;
}

.sidebar-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-content {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
}

.sidebar-toggle {
    display: none;
    border: none;
    background: #fff;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    color: var(--text-color);
}

.topbar-title {
    font-weight: 600;
    color: var(--text-color);
}

.content-area .container {
    max-width: none;
    margin: 0;
    padding: 1.5rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Login */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h1 {
    margin: 0.5rem 0;
}

.login-header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.login-form {
    padding: 2rem;
}

.login-footer {
    background: #f8f9fa;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}

/* Forms */
.form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e9ecef;
    color: #333;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Dashboard */
.dashboard {
    padding: 2rem 0;
}

.dashboard h1 {
    margin-bottom: 0.5rem;
}

.dashboard > p {
    color: #666;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 8px;
}

.stat-content h3 {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
}

.dashboard-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-section h2 {
    margin-bottom: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Apps List */
.apps-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.app-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.app-header h3 {
    margin: 0;
}

.app-info {
    margin-bottom: 1rem;
}

.app-info p {
    font-size: 0.9rem;
    color: #666;
    margin: 0.5rem 0;
}

.app-actions {
    display: flex;
    gap: 0.5rem;
}

/* Tables */
.table-section,
.filter-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table thead {
    background: #f8f9fa;
    border-bottom: 2px solid var(--border-color);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: #f9f9f9;
}

/* Pages */
.page-content {
    padding: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0;
}

.form-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-section h2 {
    margin-bottom: 1.5rem;
}

/* Footer */
.footer {
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    color: #666;
}

/* Utilities */
.no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.info-box {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.info-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    background: #f8f9fa;
    border-radius: 4px;
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.filter-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Tokens */
.token-code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: #f4f4f4;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    max-width: 300px;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .content-area .container {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .apps-list {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .table th, .table td {
        padding: 0.75rem 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }

    body.sidebar-open .sidebar {
        display: block;
    }
}
