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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 12px;
}

main {
    padding: 40px;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0 4px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-card.stat-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-card.stat-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.stat-warning {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    background: #f8f9fa;
    font-weight: 500;
    transition: all 0.3s;
}

.filter-btn:hover {
    background: #e9ecef;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.codes-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

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

.codes-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.codes-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
}

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

.codes-table tr.used {
    opacity: 0.6;
}

.codes-table tr.disabled {
    opacity: 0.4;
}

.codes-table tr.expired {
    background: #fff3cd;
}

.code-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-cell code {
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.copy-btn:hover {
    opacity: 1;
}

.device-cell {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #6c757d;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

.empty-state {
    text-align: center;
    padding: 60px 20px !important;
    color: #6c757d;
    font-size: 16px;
}

/* Form */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.form-container h2 {
    margin-bottom: 30px;
    color: #212529;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #6c757d;
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

/* Info Box */
.info-box {
    background: #e7f3ff;
    border-left: 4px solid #667eea;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
}

.info-box h3 {
    margin-bottom: 12px;
    color: #495057;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 6px 0;
    color: #495057;
}

.info-box li:before {
    content: "• ";
    color: #667eea;
    font-weight: bold;
    margin-right: 8px;
}

/* Success Container */
.success-container {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.success-icon {
    font-size: 72px;
    margin-bottom: 20px;
}

.success-container h2 {
    color: #212529;
    margin-bottom: 12px;
}

.success-container p {
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 16px;
}

.codes-list {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.code-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 12px;
}

.code-item:last-child {
    margin-bottom: 0;
}

.code-item code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
}

.export-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    color: #495057;
    background: #f8f9fa;
    font-weight: 500;
    transition: all 0.3s;
}

.page-link:hover {
    background: #e9ecef;
}

.page-link.active {
    background: #667eea;
    color: white;
}

.page-ellipsis {
    padding: 8px 12px;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    main {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .codes-table {
        font-size: 12px;
    }

    .codes-table th,
    .codes-table td {
        padding: 10px 8px;
    }
}
