/* Base Mobile-First Styles */
* {
    box-sizing: border-box;
}

body, html {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: black;
    color: white;
    position: relative;
    overflow-x: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html, body {
    height: 100%;
    overflow-y: auto;
}

#background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Header and Navigation */
header {
    background-color: transparent;
    color: white;
    padding: 10px;
    text-align: center;
}

nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 0;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    clip-path: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%);
    font-size: 14px;
}

nav a:hover {
    background-color: transparent;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    color: white;
}

/* Container */
.container {
    max-width: 800px;
    width: 100%;
    margin: 20px auto;
    padding: 15px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    box-sizing: border-box;
    position: relative;
}

/* Top Buttons */
.top-buttons {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1000;
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100% - 20px);
    max-width: 400px;
    box-sizing: border-box;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.top-buttons button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.6);
    padding: 10px 15px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    clip-path: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%);
    flex: 1;
    min-width: 100px;
}

.top-buttons button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.5);
}

/* Content */
.content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 100vh;
    z-index: 1;
    padding: 80px 20px 20px;
}

.content h1 {
    font-size: 2rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
    animation: flash 2s infinite;
    margin: 10px 0;
}

.content h2 {
    font-size: 1.5rem;
    margin-top: 20px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    animation: fadeInOut 6s infinite;
}

@keyframes flash {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.9);
    }
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    30% { opacity: 1; }
    40% { opacity: 0; }
    100% { opacity: 0; }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.4);
    text-align: center;
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: none;
    border-bottom: 2px solid white;
    background: transparent;
    color: white;
    font-size: 16px;
    box-sizing: border-box;
}

.modal-content button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    color: white;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px 5px;
    border-radius: 5px;
    font-size: 14px;
    width: auto;
    min-width: 100px;
}

.modal-content button:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.5);
}

.error-message {
    color: red;
    margin-top: 10px;
    font-size: 14px;
}

/* Avatar */
.avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
}

/* Input Fields */
.input-field {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: none;
    background-color: white;
    color: black;
    text-align: center;
    margin-top: 10px;
    border-radius: 5px;
    box-sizing: border-box;
}

#userInput {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    color: #000;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid #000;
    outline: none;
    transition: 0.3s;
    box-sizing: border-box;
    border-radius: 5px;
}

#userInput::placeholder {
    color: #000;
    opacity: 1;
}

#userInput:focus {
    border-color: #000;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Buttons */
.buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.buttons button {
    width: 100%;
    max-width: 300px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid #fff;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
}

.buttons button:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

th, td {
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 12px;
    white-space: nowrap;
}

th {
    background: rgba(255, 255, 255, 0.3);
    font-weight: bold;
    font-size: 12px;
}

tr:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat */
#chat {
    max-height: 400px;
    overflow-y: auto;
    color: white;
    text-align: left;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    box-sizing: border-box;
}

#chat::-webkit-scrollbar {
    width: 6px;
}

#chat::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

#chat::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

#chat::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

#chat_messages {
    list-style: none;
    padding: 0;
    margin: 0;
}

#chat_messages li {
    margin-bottom: 15px;
    padding: 10px 12px;
    border-radius: 12px;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
    font-size: 14px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#chat_messages .message.user {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.4);
    text-align: right;
    margin-left: 10%;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

#chat_messages .message.chatty {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.4);
    text-align: left;
    margin-right: 10%;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

#chat_messages .message.error {
    background: rgba(200, 50, 50, 0.2);
    border: 2px solid rgba(255, 68, 68, 0.6);
    color: #ffcccc;
    text-align: center;
    margin: 0 5%;
}

/* Cards */
.card {
    background-color: black;
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 16px;
    margin-top: 20px;
    border: 2px solid white;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    background-color: grey;
    height: 20px;
    border-radius: 5px;
    margin: 10px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 50%;
    background-color: white;
    text-align: right;
    padding-right: 10px;
    color: black;
    font-weight: bold;
}

/* Canvas */
canvas {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    margin-top: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Telegram Button */
.telegram-link {
    font-weight: bold;
    color: white;
    text-decoration: underline;
    text-decoration-color: #1e90ff;
    text-underline-offset: 3px;
    cursor: pointer;
}

.telegram-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    margin-top: 20px;
    background: linear-gradient(135deg, #0088cc 0%, #0066aa 100%);
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
    cursor: pointer;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
}

.telegram-button:hover {
    background: linear-gradient(135deg, #0099dd 0%, #0077bb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2a2a2a;
    padding: 15px 20px;
    z-index: 10000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    display: block;
}

.cookie-banner.hidden {
    display: none;
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.cookie-banner-text {
    flex: 1;
    color: #d0d0d0;
    width: 100%;
}

.cookie-banner-text h2 {
    font-size: 18px;
    font-weight: bold;
    color: #d0d0d0;
    margin: 0 0 8px 0;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #d0d0d0;
}

.cookie-banner-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    width: 100%;
}

.cookie-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 100px;
    border: 1px solid;
}

.cookie-btn-reject {
    background: #2a2a2a;
    border-color: #ffffff;
    color: #d0d0d0;
}

.cookie-btn-reject:hover {
    background: #3a3a3a;
    border-color: #ffffff;
}

.cookie-btn-accept {
    background: #007bff;
    border-color: #007bff;
    color: #ffffff;
}

.cookie-btn-accept:hover {
    background: #0056b3;
    border-color: #0056b3;
}

/* Message Cards */
.message-card {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

.message-card .avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ccc;
    font-size: 30px;
    color: white;
    text-align: center;
    font-weight: bold;
    border: 2px solid #ddd;
    margin-bottom: 10px;
}

.message-card .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border: 1px solid #ffa500;
}

.status-completed {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
    border: 1px solid #00ff00;
}

.status-failed {
    background: rgba(255, 0, 0, 0.2);
    color: #ff0000;
    border: 1px solid #ff0000;
}

/* Forms */
form {
    width: 100%;
    box-sizing: border-box;
}

form input,
form select,
form textarea {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

form input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Mobile-specific improvements */
@media (max-width: 480px) {
    .top-buttons {
        top: 5px !important;
        gap: 6px !important;
        width: calc(100% - 10px) !important;
    }
    
    .top-buttons button {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    .container {
        padding: 10px !important;
        margin: 10px auto !important;
    }
    
    .container h1 {
        font-size: 1.2rem !important;
    }
    
    .container p {
        font-size: 12px !important;
    }
    
    #userInput {
        padding: 10px !important;
        font-size: 16px !important;
    }
    
    .buttons button {
        padding: 10px 12px !important;
        font-size: 14px !important;
    }
    
    #chat {
        max-height: 250px !important;
        padding: 8px !important;
    }
    
    .avatar img {
        width: 60px !important;
        height: 60px !important;
    }
}

/* Responsive Design for Tablets and Desktops */
@media (min-width: 768px) {
    .content h1 {
        font-size: 3rem;
    }
    
    .content h2 {
        font-size: 2rem;
    }
    
    .container {
        padding: 20px;
        margin: 50px auto;
    }
    
    .top-buttons {
        top: 20px;
        gap: 20px;
        flex-direction: row;
        max-width: none;
    }
    
    .top-buttons button {
        padding: 15px 25px;
        font-size: 16px;
        flex: none;
    }
    
    nav {
        gap: 20px;
    }
    
    nav a {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    .avatar img {
        width: 120px;
        height: 120px;
    }
    
    #userInput {
        width: 80%;
    }
    
    .buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .buttons button {
        width: auto;
        max-width: none;
    }
    
    table {
        display: table;
    }
    
    th, td {
        padding: 12px;
        font-size: 16px;
    }
    
    #chat_messages .message.user {
        margin-left: 20%;
    }
    
    #chat_messages .message.chatty {
        margin-right: 20%;
    }
    
    .modal-content {
        width: 400px;
        padding: 30px;
    }
    
    .cookie-banner-content {
        flex-direction: row;
        align-items: center;
    }
    
    .cookie-banner-text h2 {
        font-size: 20px;
    }
    
    .cookie-banner-text p {
        font-size: 13px;
    }
    
    .cookie-banner-buttons {
        width: auto;
        flex-direction: row;
    }
    
    .cookie-btn {
        flex: none;
    }
    
    .telegram-button {
        width: auto;
        padding: 15px 30px;
        font-size: 16px;
    }
    
    .message-card {
        flex-direction: row;
        align-items: center;
    }
    
    .message-card .avatar {
        width: 80px;
        height: 80px;
        font-size: 40px;
        margin-bottom: 0;
        margin-right: 15px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1000px;
    }
}
