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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    margin-bottom: 30px;
    text-align: center;
    color: #1a73e8;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: #1a73e8;
}

input:disabled {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

button {
    width: 100%;
    padding: 12px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #1557b0;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error {
    color: #d93025;
    margin-top: 10px;
    font-size: 14px;
}

.success {
    color: #188038;
    margin-top: 10px;
    font-size: 14px;
}

/* Dashboard Layout */
.dashboard {
    display: none;
    min-height: 100vh;
    background: #f5f5f5;
}

.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #1a73e8;
    font-size: 24px;
}

/* User Menu */
.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    width: auto;
}

.user-menu-btn:hover {
    background: #e9ecef;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.user-dropdown a:hover {
    background: #f8f9fa;
}

.user-dropdown a:last-child {
    border-bottom: none;
}

/* Navigation */
.main-nav {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 0 20px;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-item:hover {
    color: #1a73e8;
    background: #f8f9fa;
}

.nav-item.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    background: #f8f9fa;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
}

/* Content */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.section h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    font-weight: normal;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: #1a73e8;
    margin-bottom: 5px;
}

.stat-card .change {
    font-size: 12px;
    color: #188038;
}

.stat-card .subtitle {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* API Key Form */
.api-key-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

.full-width {
    grid-column: 1 / -1;
}

.permissions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.permission-check {
    display: flex;
    align-items: center;
    gap: 5px;
}

.permission-check input[type="checkbox"] {
    width: auto;
}

.permission-check label {
    margin: 0;
    font-weight: normal;
}

/* Lists */
.api-keys-list {
    margin-top: 20px;
}

.api-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.api-key-info {
    flex: 1;
}

.api-key-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.api-key-details {
    font-size: 14px;
    color: #666;
}

.api-key-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    width: auto;
}

.btn-danger {
    background: #dc3545;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-revoked {
    background: #f8d7da;
    color: #721c24;
}

.status-expired {
    background: #fff3cd;
    color: #856404;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-super-admin {
    background: #f8d7da;
    color: #721c24;
}

.role-admin {
    background: #d4edda;
    color: #155724;
}

.role-viewer {
    background: #e2e3e5;
    color: #495057;
}

/* Activity List */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.activity-meta {
    font-size: 14px;
    color: #666;
}

/* Health Grid */
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.health-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-weight: 500;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-healthy {
    background: #28a745;
}

.status-warning {
    background: #ffc107;
}

.status-error {
    background: #dc3545;
}

.health-detail {
    font-size: 14px;
    color: #666;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content.modal-large {
    max-width: 800px;
}

.user-details h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.user-details h3:first-child {
    margin-top: 0;
}

.details-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.details-section p {
    margin: 8px 0;
    color: #555;
}

.details-section strong {
    color: #333;
    min-width: 120px;
    display: inline-block;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: auto;
}

.api-key-display {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    font-family: monospace;
    word-break: break-all;
    margin: 20px 0;
}

.copy-btn {
    background: #28a745;
    margin-top: 10px;
}

.two-factor-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

.qr-code {
    text-align: center;
    margin: 20px 0;
}

.qr-code img {
    max-width: 200px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Navigation Dropdown Styles */
.nav-item-with-dropdown {
    position: relative;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
}

.nav-dropdown.show {
    display: block;
}

.nav-dropdown a {
    display: block;
    padding: 12px 24px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
    border-bottom: 1px solid #f0f0f0;
}

.nav-dropdown a:last-child {
    border-bottom: none;
}

.nav-dropdown a:hover {
    background: #f8f9fa;
    color: #1a73e8;
}

.nav-dropdown a.active {
    background: #f8f9fa;
    color: #1a73e8;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .api-key-form {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
    }
    
    .nav-content {
        flex-direction: column;
    }
    
    .nav-item {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .nav-item.active {
        border-left-color: #1a73e8;
        border-bottom-color: transparent;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .api-key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: #666;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Embed Code Section */
.embed-options {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.embed-options .form-group {
    flex: 1;
}

.embed-code-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.embed-code-container h3 {
    margin-top: 0;
    color: #495057;
}

.embed-code-container pre {
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 15px 0;
}

.embed-code-container code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #e83e8c;
}

.embed-info {
    background: #e8f4fd;
    padding: 20px;
    border-radius: 8px;
    color: #0066cc;
}

.embed-info h3 {
    margin-top: 0;
    color: #0052a3;
}

.embed-info ol,
.embed-info ul {
    margin: 10px 0;
}

.embed-info a {
    color: #0052a3;
    font-weight: 600;
}