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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 700px;
    width: 90%;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.screen {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.login-form, .debrid-form {
    text-align: center;
}

.login-form h2, .debrid-form h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8em;
}

input[type="text"], input[type="password"], input[type="url"], input[type="email"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="password"]:focus, input[type="url"]:focus, input[type="email"]:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-help {
    margin-top: 30px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    text-align: center;
}

.login-help p {
    margin: 10px 0;
    color: #333;
}

.login-help code {
    background: rgba(102, 126, 234, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.telegram-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: #0088cc;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background 0.3s;
}

.telegram-link:hover {
    background: #006699;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.user-details span {
    display: block;
    color: #333;
}

.user-details span:first-child {
    font-weight: bold;
    font-size: 1.1em;
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.secondary-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    padding: 8px 16px;
    font-size: 14px;
}

.admin-btn {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
    padding: 8px 16px;
    font-size: 14px;
}

.logout-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    padding: 8px 16px;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.result h3 {
    color: #155724;
    margin-bottom: 15px;
}

.result-content p {
    margin-bottom: 15px;
    color: #155724;
}

.download-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.download-btn, .copy-btn {
    flex: 1;
    min-width: 150px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.download-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.copy-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border: 1px solid #f5c6cb;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #333;
    margin: 0;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-details {
    flex: 1;
}

.history-details h4 {
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.history-details p {
    color: #666;
    font-size: 12px;
    margin: 2px 0;
}

.history-link {
    display: inline-block;
    padding: 5px 10px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 15px;
    }

    header h1 {
        font-size: 2em;
    }

    .user-info {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .user-actions {
        justify-content: center;
    }

    .download-section {
        flex-direction: column;
    }

    .download-btn, .copy-btn {
        width: 100%;
    }
}
