/* Give Me SSL - Admin Panel Styles */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --error: #dc2626;
    --info: #0891b2;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --nav-bg: #1e293b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.admin-nav {
    background: var(--nav-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Admin container */
.admin-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Setup container (login / setup pages) */
.setup-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

.stat-warning .stat-number { color: var(--warning); }
.stat-info .stat-number    { color: var(--info); }
.stat-success .stat-number { color: var(--success); }
.stat-error .stat-number   { color: var(--error); }

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.3rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.55rem 1.15rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    vertical-align: middle;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
}

/* Alerts */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.alert-info {
    background: #ecfeff;
    color: #155e75;
    border: 1px solid #a5f3fc;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.data-table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

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

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

/* Detail table */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.detail-table th {
    width: 150px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.detail-table code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.82rem;
    word-break: break-all;
}

/* Code blocks */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;
    font-size: 0.82rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    word-break: break-all;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-pending_challenge { background: #f3e8ff; color: #6b21a8; }
.badge-pending_dns { background: #fef3c7; color: #92400e; }
.badge-queued      { background: #dbeafe; color: #1e40af; }
.badge-processing  { background: #e0e7ff; color: #3730a3; }
.badge-done        { background: #dcfce7; color: #166534; }
.badge-failed      { background: #fee2e2; color: #991b1b; }

.text-error {
    color: var(--error);
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.3rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Bar chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    min-height: 180px;
    padding-top: 0.5rem;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
}

.bar-value {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.bar-track {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: flex-end;
}

.bar-fill {
    width: 100%;
    background: #6366f1;
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 2px;
    transition: height 0.3s ease;
}

.bar-fill-done {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #10b981;
    border-radius: 0 0 0 0;
}

.bar-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    white-space: nowrap;
}

/* Button warning */
.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #a16207;
    color: #fff;
}

/* Responsive */
@media (max-width: 640px) {
    .admin-nav {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-container {
        padding: 1.25rem 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table {
        font-size: 0.82rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.4rem 0.5rem;
    }
}
