/* CSS Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --error-color: #ff6b6b;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.15);
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-attachment: fixed;
    color: var(--text-primary);
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
}

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

/* Container & Card */
.container {
    width: 100%;
    max-width: 500px;
    min-width: 500px;
    margin: 0 auto;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Icons */
.icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.icon-wrapper.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: scaleIn 0.5s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lock-icon,
.upload-icon,
.check-icon {
    width: 40px;
    height: 40px;
    color: var(--text-primary);
}

/* Typography */
.title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 16px;
    font-weight: 400;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Form Elements */
.input-group {
    margin-bottom: 16px;
}

input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

input[type="password"]::placeholder,
input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

input[type="password"]:focus,
input[type="text"]:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
}

.btn-primary:hover:not(:disabled) {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* Drop Zone */
.drop-zone {
    margin-bottom: 24px;
    padding: 48px 24px;
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

.drop-zone:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.drop-zone.drag-over {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.drop-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
}

.drop-text {
    color: var(--text-secondary);
    font-size: 15px;
}

#file-input {
    display: none;
}

/* File List */
.file-list {
    margin-bottom: 24px;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.file-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 12px;
}

.file-remove {
    margin-left: 12px;
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.file-remove:hover {
    transform: scale(1.2);
}

/* Progress Bar */
.upload-progress {
    margin-bottom: 24px;
}

.upload-progress.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Error Message */
.error-message {
    color: var(--error-color);
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
    min-height: 20px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 600px) {
    .card {
        padding: 36px 24px;
    }

    .title {
        font-size: 28px;
    }

    .subtitle {
        font-size: 14px;
    }
}

/* Scrollbar Styling */
.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Link Button */
.link-btn {
    margin-top: 24px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.link-btn:hover {
    color: var(--text-primary);
}

.link-icon {
    width: 16px;
    height: 16px;
}

/* Admin Container */
.admin-container {
    max-width: 1200px;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.admin-header .title {
    margin-bottom: 0;
    text-align: left;
}

/* Small Button */
.btn-small {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
}

/* Admin Section */
.admin-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

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

.section-header .section-title {
    margin-bottom: 0;
}

/* Token Form */
.token-form {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

select {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
    cursor: pointer;
}

select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

select option {
    background: #667eea;
    color: white;
}

/* Success Message */
.success-message {
    color: #4ade80;
    font-size: 14px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(74, 222, 128, 0.2);
    display: none;
}

.success-message:not(:empty) {
    display: block;
}

/* Token List */
.token-list {
    overflow-x: auto;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 32px;
}

/* Token Table */
.token-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.token-table thead {
    background: rgba(255, 255, 255, 0.1);
}

.token-table th {
    padding: 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.token-table tbody tr {
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.token-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

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

.token-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.token-table td.token-name-cell {
    color: var(--text-primary);
    font-weight: 600;
}

.token-table td.token-url-cell {
    max-width: 300px;
}

.token-url-display {
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.token-table .token-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.token-table .btn-copy,
.token-table .btn-delete {
    flex: none;
    width: auto;
    min-width: 80px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-copy {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-copy:hover {
    background: rgba(59, 130, 246, 0.3);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

/* Responsive Design for Admin */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .admin-header .title {
        text-align: center;
        width: 100%;
    }

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

    .token-table th,
    .token-table td {
        padding: 12px 8px;
    }

    .token-table td.token-url-cell {
        max-width: 150px;
    }

    .token-table .token-actions {
        flex-direction: column;
        gap: 4px;
    }

    .token-table .btn-copy,
    .token-table .btn-delete {
        width: 100%;
    }
}
