﻿:root {
    --bg-1: #140022;
    --bg-2: #2f0a59;
    --bg-3: #7c3aed;
    --ink: #1b0f2c;
    --muted: #66507f;
    --surface: #ffffff;
    --surface-2: #f8f3ff;
    --border: #e4d6ff;
    --accent: #a855f7;
    --accent-2: #ec4899;
    --accent-3: #7c3aed;
    --success: #10b981;
    --danger: #dc2626;
    --shadow-1: 0 24px 55px rgba(24, 7, 46, 0.3);
    --shadow-2: 0 12px 24px rgba(24, 7, 46, 0.2);
}

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

body {
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Tahoma", sans-serif;
    color: var(--ink);
    background-color: var(--bg-1);
    background-image:
        radial-gradient(900px 600px at 10% -10%, rgba(168, 85, 247, 0.55), transparent 60%),
        radial-gradient(760px 560px at 115% 5%, rgba(236, 72, 153, 0.5), transparent 58%),
        radial-gradient(680px 520px at 65% 120%, rgba(124, 58, 237, 0.55), transparent 62%),
        linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 40%, #5b21b6 70%, #ec4899 100%);
    background-size: 220% 220%;
    animation: gradientShift 18s ease infinite;
    min-height: 100vh;
    padding: 24px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: -10%;
    background-image:
        radial-gradient(560px 420px at 12% 18%, rgba(168, 85, 247, 0.65), transparent 62%),
        radial-gradient(520px 400px at 88% 8%, rgba(236, 72, 153, 0.6), transparent 60%),
        radial-gradient(620px 520px at 60% 95%, rgba(124, 58, 237, 0.55), transparent 64%);
    opacity: 0.8;
    animation: floatGlow 16s ease-in-out infinite;
    pointer-events: none;
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1px, transparent 120px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 120px);
    opacity: 0.35;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 640px;
    margin: 64px auto 40px;
    position: relative;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--surface);
    border-radius: 18px;
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    margin-bottom: 20px;
    animation: rise 0.6s ease-out both;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 60px rgba(24, 7, 46, 0.28);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes floatGlow {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-22px) scale(1.05);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes buttonShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

h1,
h2,
h3 {
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, "Georgia", serif;
    color: var(--ink);
    letter-spacing: 0.2px;
}

h1 {
    margin-bottom: 12px;
    font-size: 30px;
}

h2 {
    margin-bottom: 18px;
    font-size: 22px;
    border-bottom: 2px solid rgba(139, 92, 246, 0.25);
    padding-bottom: 8px;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 28px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.2px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: #fbf7ff;
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

textarea {
    resize: vertical;
    font-family: "Courier New", monospace;
    font-size: 14px;
}

small {
    color: var(--muted);
    font-size: 13px;
}

.btn {
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    width: auto;
}

.btn-primary {
    background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
    background-size: 200% 200%;
    animation: buttonShift 6s ease infinite;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(168, 85, 247, 0.35);
}

.btn-primary::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -30%;
    width: 60%;
    height: 200%;
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(20deg) translateX(-140%);
    transition: transform 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(168, 85, 247, 0.45);
}

.btn-primary:hover::after {
    transform: rotate(20deg) translateX(220%);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #2b1642;
    color: #f7f1ff;
}

.btn-secondary:hover {
    filter: brightness(1.08);
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    margin-left: 8px;
    width: auto;
}

.message {
    padding: 14px 16px;
    border-radius: 10px;
    margin-top: 20px;
    font-weight: 600;
}

.message.success {
    background: rgba(139, 92, 246, 0.12);
    color: #4c1d95;
    border: 1px solid rgba(139, 92, 246, 0.22);
}

.message.error {
    background: rgba(220, 38, 38, 0.12);
    color: #7a1c1c;
    border: 1px solid rgba(220, 38, 38, 0.22);
}

.footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.88);
    margin-top: 30px;
    opacity: 0.9;
}

.footer .contact {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
}

.admin-header {
    background: var(--surface);
    padding: 20px 30px;
    border-radius: 14px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
}

.admin-header h1 {
    margin: 0;
}

.admin-header .btn {
    width: auto;
}

.admin-content {
    display: grid;
    gap: 20px;
}

.team-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-2);
}

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

.team-header h3 {
    margin: 0;
    color: var(--ink);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background: var(--accent);
    color: #ffffff;
}

.team-info {
    background: var(--surface-2);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.team-info p {
    margin: 8px 0;
    color: var(--muted);
}

code {
    background: var(--surface-2);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.keys-section {
    margin: 20px 0;
}

.keys-section h4 {
    margin-bottom: 12px;
    color: var(--muted);
}

.key-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(139, 92, 246, 0.12);
}

.key-item.used {
    background: #e9defa;
    opacity: 0.75;
}

.key-number {
    font-weight: 700;
    color: var(--accent);
    margin-right: 10px;
    min-width: 30px;
}

.key-code {
    flex: 1;
    font-size: 12px;
    word-break: break-all;
}

.key-status {
    color: var(--success);
    font-size: 13px;
    margin-left: 10px;
}

.team-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.team-actions .btn {
    width: auto;
    flex: 1;
}

.invitations-table {
    width: 100%;
    border-collapse: collapse;
}

.invitations-table th,
.invitations-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.invitations-table th {
    background: #f3eaff;
    font-weight: 700;
    color: var(--muted);
}

.status-success {
    color: var(--success);
    font-weight: 600;
}

.status-failed {
    color: var(--danger);
    font-weight: 600;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px;
}

input[type="time"] {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fbf7ff;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 8px;
    accent-color: var(--accent);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(24, 10, 45, 0.6);
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-1);
    border: 1px solid var(--border);
}

.close {
    color: var(--muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: var(--ink);
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.team-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    background: var(--surface);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.team-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 10px 24px rgba(139, 92, 246, 0.18);
    transform: translateY(-2px);
}

.team-card .team-header {
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    padding-bottom: 15px;
}

.team-header h3 {
    margin: 0;
    color: var(--ink);
    font-size: 18px;
}

.team-info p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--muted);
}

.team-info code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.team-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-owner {
    background: var(--accent-2);
    color: #2d0d20;
}

.badge-temp {
    background: #c026d3;
    color: #ffffff;
}

.badge-success {
    background: var(--success);
    color: #ffffff;
}

.badge-error {
    background: var(--danger);
    color: #ffffff;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    gap: 15px;
}

.member-info {
    flex: 1;
}

.member-info strong {
    font-size: 15px;
    color: var(--ink);
}

.member-info .badge {
    margin-left: 10px;
}

.member-meta {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.member-meta small {
    color: var(--muted);
    font-size: 12px;
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.key-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    gap: 15px;
}

.key-info {
    flex: 1;
}

.key-code {
    background: var(--surface-2);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.2);
    display: inline-block;
}

.key-meta {
    margin-top: 8px;
}

.key-meta small {
    color: var(--muted);
    font-size: 12px;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.log-table th,
.log-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.log-table th {
    background: #f3eaff;
    font-weight: 700;
    color: var(--muted);
    font-size: 14px;
}

.log-table td {
    font-size: 13px;
    color: var(--muted);
}

.log-table tr:hover {
    background: rgba(139, 92, 246, 0.08);
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .container {
        margin: 40px auto 24px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
    }

    .admin-header .btn {
        width: 100%;
    }

    .team-actions {
        flex-direction: column;
    }

    .team-actions .btn {
        width: 100%;
    }

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

    .member-item,
    .key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }

    body::before,
    body::after {
        animation: none !important;
    }
}
