/* ============ Variables ============ */
:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --primary-light: #A78BFA;
    --success: #10B981;
    --success-light: #34D399;
    --warning: #F59E0B;
    --danger: #EF4444;
    --danger-light: #FCA5A5;
    
    --bg-dark: #0F172A;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --bg-input: #0F172A;
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --border: #334155;
    --border-light: #475569;
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    
    --radius: 12px;
    --radius-sm: 8px;
}

/* ============ Reset ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ============ Screens ============ */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ============ Login Screen ============ */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger-light);
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ============ Header ============ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-small {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.header-left h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============ Main Content ============ */
.main-content {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============ Stats Grid ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.revoked {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-icon.expired {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.total {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============ Actions Bar ============ */
.actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.actions-bar h3 {
    font-size: 20px;
    font-weight: 600;
}

/* ============ Table ============ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.licenses-table {
    width: 100%;
    border-collapse: collapse;
}

.licenses-table th,
.licenses-table td {
    padding: 16px;
    text-align: left;
}

.licenses-table th {
    background: var(--bg-hover);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.licenses-table td {
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.licenses-table tr:hover {
    background: var(--bg-hover);
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.license-key {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    background: var(--bg-input);
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--primary-light);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.revoked {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge.expired {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.revoke {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-btn.revoke:hover {
    background: var(--danger);
    color: white;
}

.action-btn.activate {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.action-btn.activate:hover {
    background: var(--success);
    color: white;
}

.action-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-btn.delete:hover {
    background: var(--danger);
    color: white;
}

/* ============ Modal ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content form {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* License Created Modal */
.license-created-content {
    padding: 24px;
}

.license-created-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.license-key-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.license-key-display code {
    flex: 1;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 18px;
    color: var(--success);
    letter-spacing: 1px;
}

.license-details p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.license-details strong {
    color: var(--text-primary);
}

.modal-success .modal-actions {
    padding: 0 24px 24px;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .licenses-table th,
    .licenses-table td {
        padding: 12px;
    }
}
