/* ===== Telegram-style Theme ===== */
:root {
    --tg-blue: #2AABEE;
    --tg-blue-dark: #229ED9;
    --tg-blue-light: #e8f4fd;
    --tg-bg: #e7f0f7;
    --tg-sky-top: #b8d8f0;
    --tg-sky-bottom: #dfedf8;
    --tg-card-shadow: 0 2px 20px rgba(42, 171, 238, 0.12);
    --tg-text: #333;
    --tg-text-muted: #8e9baa;
    --tg-green: #34c759;
    --tg-orange: #f5a623;
    --tg-red: #e85656;
    --tg-radius: 16px;
    --tg-border: rgba(42, 171, 238, 0.15);
    --tg-bg-secondary: #f0f5fa;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(180deg, var(--tg-sky-top) 0%, var(--tg-sky-bottom) 40%, var(--tg-bg) 100%);
    min-height: 100vh;
    color: var(--tg-text);
    position: relative;
    overflow-x: hidden;
}

/* ===== Floating paper airplanes ===== */
body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0.07;
    background-repeat: no-repeat;
    background-size: contain;
}

body::before {
    width: 120px;
    height: 120px;
    top: 60px;
    left: 8%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10 50 L90 10 L60 90 L48 55 Z' fill='%232AABEE'/%3E%3Cpath d='M48 55 L90 10 L60 90 Z' fill='%23229ED9'/%3E%3C/svg%3E");
    transform: rotate(-15deg);
    animation: floatPlane1 8s ease-in-out infinite;
}

body::after {
    width: 80px;
    height: 80px;
    bottom: 100px;
    right: 6%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10 50 L90 10 L60 90 L48 55 Z' fill='%232AABEE'/%3E%3Cpath d='M48 55 L90 10 L60 90 Z' fill='%23229ED9'/%3E%3C/svg%3E");
    transform: rotate(20deg);
    animation: floatPlane2 10s ease-in-out infinite;
}

@keyframes floatPlane1 {
    0%, 100% { transform: rotate(-15deg) translateY(0); }
    50% { transform: rotate(-10deg) translateY(-20px); }
}

@keyframes floatPlane2 {
    0%, 100% { transform: rotate(20deg) translateY(0); }
    50% { transform: rotate(25deg) translateY(-15px); }
}

/* ===== Clouds decoration ===== */
.tg-clouds {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.tg-cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    filter: blur(30px);
}

.tg-cloud-1 { width: 300px; height: 80px; top: 5%; left: -5%; animation: driftCloud 25s linear infinite; }
.tg-cloud-2 { width: 200px; height: 60px; top: 15%; left: 40%; animation: driftCloud 30s linear infinite 5s; }
.tg-cloud-3 { width: 250px; height: 70px; top: 8%; right: -10%; animation: driftCloud 28s linear infinite 10s; }

@keyframes driftCloud {
    0% { transform: translateX(-100px); }
    100% { transform: translateX(100px); }
}

/* ===== Content wrapper ===== */
.tg-content {
    position: relative;
    z-index: 1;
}

/* ===== Navbar ===== */
.tg-navbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(42, 171, 238, 0.1);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.tg-navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tg-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--tg-text);
    font-weight: 700;
    font-size: 1.15rem;
}

.tg-brand:hover { color: var(--tg-blue); }

.tg-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--tg-blue), var(--tg-blue-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.tg-nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tg-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
    color: var(--tg-text-muted);
    background: transparent;
}

.tg-nav-btn:hover {
    background: var(--tg-blue-light);
    color: var(--tg-blue);
}

.tg-nav-btn.active {
    background: var(--tg-blue);
    color: white;
    border-color: var(--tg-blue);
}

/* ===== Cards ===== */
.tg-card {
    background: white;
    border-radius: var(--tg-radius);
    box-shadow: var(--tg-card-shadow);
    border: 1px solid rgba(42, 171, 238, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.tg-card:hover {
    box-shadow: 0 4px 30px rgba(42, 171, 238, 0.18);
}

.tg-card-body {
    padding: 28px;
}

.tg-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tg-text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tg-card-title i {
    color: var(--tg-blue);
}

/* ===== Buttons ===== */
.tg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.tg-btn:active { transform: scale(0.97); }

.tg-btn-primary {
    background: linear-gradient(135deg, var(--tg-blue), var(--tg-blue-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(42, 171, 238, 0.35);
}

.tg-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(42, 171, 238, 0.45);
    color: white;
    transform: translateY(-1px);
}

.tg-btn-success {
    background: linear-gradient(135deg, #34c759, #2db84d);
    color: white;
    box-shadow: 0 4px 14px rgba(52, 199, 89, 0.3);
}

.tg-btn-success:hover {
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.4);
    color: white;
    transform: translateY(-1px);
}

.tg-btn-warning {
    background: linear-gradient(135deg, #f5a623, #e8961a);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 166, 35, 0.3);
}

.tg-btn-warning:hover {
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.4);
    color: white;
    transform: translateY(-1px);
}

.tg-btn-outline {
    background: transparent;
    color: var(--tg-blue);
    border: 2px solid var(--tg-blue);
}

.tg-btn-outline:hover {
    background: var(--tg-blue);
    color: white;
}

.tg-btn-ghost {
    background: var(--tg-blue-light);
    color: var(--tg-blue);
}

.tg-btn-ghost:hover {
    background: #d4eaf7;
    color: var(--tg-blue-dark);
}

.tg-btn-block { width: 100%; }

.tg-btn-lg {
    padding: 16px 28px;
    font-size: 1rem;
    border-radius: 14px;
}

/* ===== Forms ===== */
.tg-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e4e9f0;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
    background: #f8fafc;
}

.tg-input:focus {
    border-color: var(--tg-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(42, 171, 238, 0.1);
}

.tg-input::placeholder { color: #b0bec5; }

.tg-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tg-text-muted);
    margin-bottom: 6px;
}

.tg-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e4e9f0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: #f8fafc;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tg-select:focus {
    border-color: var(--tg-blue);
    box-shadow: 0 0 0 4px rgba(42, 171, 238, 0.1);
}

.tg-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e4e9f0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: #f8fafc;
    outline: none;
    resize: vertical;
    transition: all 0.2s ease;
    min-height: 100px;
}

.tg-textarea:focus {
    border-color: var(--tg-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(42, 171, 238, 0.1);
}

.tg-form-group {
    margin-bottom: 18px;
}

/* ===== Alerts ===== */
.tg-alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tg-alert-info {
    background: var(--tg-blue-light);
    color: var(--tg-blue-dark);
    border: 1px solid rgba(42, 171, 238, 0.2);
}

.tg-alert-success {
    background: #eafbe7;
    color: #2d8f3e;
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.tg-alert-warning {
    background: #fff8e8;
    color: #b8860b;
    border: 1px solid rgba(245, 166, 35, 0.2);
}

.tg-alert-danger {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid rgba(232, 86, 86, 0.2);
}

/* ===== Progress ===== */
.tg-progress-wrap {
    margin-bottom: 16px;
}

.tg-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--tg-text-muted);
    margin-bottom: 6px;
}

.tg-progress {
    height: 22px;
    background: #e8edf2;
    border-radius: 11px;
    overflow: hidden;
}

.tg-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--tg-blue), var(--tg-blue-dark));
    border-radius: 11px;
    transition: width 0.5s ease;
    position: relative;
}

.tg-progress-bar.animated {
    background: linear-gradient(90deg, var(--tg-blue), var(--tg-blue-dark), var(--tg-blue));
    background-size: 200% 100%;
    animation: progressShimmer 1.5s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Telegram Logo SVG Inline ===== */
.tg-logo-big {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--tg-blue), var(--tg-blue-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(42, 171, 238, 0.35);
}

.tg-logo-big i {
    font-size: 2.5rem;
    color: white;
    margin: 0;
}

/* ===== Status icons ===== */
.tg-status-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.6rem;
}

.tg-status-icon.loading {
    background: var(--tg-blue-light);
    color: var(--tg-blue);
    animation: pulse 1.5s ease-in-out infinite;
}

.tg-status-icon.success {
    background: #eafbe7;
    color: var(--tg-green);
}

.tg-status-icon.error {
    background: #fde8e8;
    color: var(--tg-red);
}

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

/* ===== Code input (verification) ===== */
.tg-code-input {
    font-size: 1.8rem;
    text-align: center;
    letter-spacing: 10px;
    font-weight: 700;
    color: var(--tg-blue-dark);
}

/* ===== Format toggle ===== */
.tg-format-group {
    display: flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e4e9f0;
}

.tg-format-group input[type="radio"] { display: none; }

.tg-format-group label {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tg-text-muted);
    background: #f8fafc;
    transition: all 0.2s ease;
    border-right: 1px solid #e4e9f0;
}

.tg-format-group label:last-child { border-right: none; }

.tg-format-group input[type="radio"]:checked + label {
    background: var(--tg-blue);
    color: white;
}

/* ===== Type selector (send page) ===== */
.tg-type-option {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #e4e9f0;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    background: #f8fafc;
}

.tg-type-option:hover {
    border-color: var(--tg-blue);
    background: var(--tg-blue-light);
}

.tg-type-option.active {
    border-color: var(--tg-blue);
    background: var(--tg-blue-light);
    box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.15);
}

.tg-type-option i {
    font-size: 1.6rem;
    color: var(--tg-blue);
    margin: 0 0 6px;
    display: block;
}

.tg-type-option .tg-type-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--tg-text);
}

.tg-type-option .tg-type-desc {
    font-size: 0.75rem;
    color: var(--tg-text-muted);
}

/* ===== Table ===== */
.tg-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.tg-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tg-text-muted);
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 2px solid #e8edf2;
    background: #f8fafc;
}

.tg-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f3f7;
    font-size: 0.9rem;
    vertical-align: middle;
}

.tg-table tbody tr:hover {
    background: var(--tg-blue-light);
}

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

/* ===== Empty state ===== */
.tg-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-text-muted);
}

.tg-empty i {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.4;
}

.tg-empty p { margin: 0; }

/* ===== Link ===== */
.tg-link {
    color: var(--tg-blue);
    text-decoration: none;
    font-weight: 600;
}

.tg-link:hover {
    color: var(--tg-blue-dark);
    text-decoration: underline;
}

/* ===== Photo preview ===== */
.tg-photo-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e4e9f0;
    margin-top: 8px;
}

/* ===== Footer ===== */
.tg-footer {
    text-align: center;
    padding: 20px;
    color: var(--tg-text-muted);
    font-size: 0.8rem;
    opacity: 0.6;
}

/* ===== Home page hero ===== */
.tg-hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.tg-hero-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--tg-text);
    margin-bottom: 8px;
}

.tg-hero-subtitle {
    font-size: 1rem;
    color: var(--tg-text-muted);
    margin-bottom: 24px;
}

/* ===== Side floating image ===== */
.tg-side-image {
    position: fixed;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.tg-side-image img {
    max-width: 340px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 12px 32px rgba(42, 171, 238, 0.25));
    animation: heroFloat 4s ease-in-out infinite;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

@media (max-width: 1400px) {
    .tg-side-image img { max-width: 280px; }
}

@media (max-width: 1200px) {
    .tg-side-image img { max-width: 220px; }
    .tg-side-image { right: 2%; }
}

.tg-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

/* ===== Form hint ===== */
.tg-hint {
    font-size: 0.78rem;
    color: var(--tg-text-muted);
    margin-top: 4px;
}

/* ===== Spinner ===== */
.tg-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.tg-spinner-blue {
    border-color: rgba(42, 171, 238, 0.2);
    border-top-color: var(--tg-blue);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Download button small ===== */
.tg-btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 8px;
}

/* ===== User nav ===== */
.tg-nav-user {
    color: var(--tg-text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}
.tg-nav-btn-logout {
    color: var(--tg-text-muted) !important;
    padding: 6px 8px !important;
}
.tg-nav-btn-logout:hover {
    color: var(--tg-red) !important;
}

/* ===== Flying characters on airplanes ===== */
.tg-flying-chars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.tg-flyer {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.tg-flyer-img {
    width: 200px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

/* Mirror right-side characters to face left toward center */
.tg-flyer-img-mirror {
    transform: scaleX(-1);
}

/* Left side — upper */
.tg-flyer-1 {
    top: 12%;
    left: 4%;
    animation: flyLeft1 9s ease-in-out infinite;
}

/* Left side — lower */
.tg-flyer-2 {
    bottom: 10%;
    left: 5%;
    animation: flyLeft2 11s ease-in-out infinite 1s;
}

/* Right side — upper (mirrored) */
.tg-flyer-3 {
    top: 12%;
    right: 4%;
    animation: flyRight1 10s ease-in-out infinite 0.5s;
}

/* Right side — lower (mirrored) */
.tg-flyer-4 {
    bottom: 10%;
    right: 5%;
    animation: flyRight2 8.5s ease-in-out infinite 2s;
}

@keyframes flyLeft1 {
    0%, 100% { transform: rotate(-12deg) translateY(0px); }
    50% { transform: rotate(-6deg) translateY(-18px); }
}

@keyframes flyLeft2 {
    0%, 100% { transform: rotate(-15deg) translateY(0px); }
    50% { transform: rotate(-20deg) translateY(-22px); }
}

@keyframes flyRight1 {
    0%, 100% { transform: rotate(12deg) translateY(0px); }
    50% { transform: rotate(6deg) translateY(-20px); }
}

@keyframes flyRight2 {
    0%, 100% { transform: rotate(15deg) translateY(0px); }
    50% { transform: rotate(20deg) translateY(-16px); }
}

/* ===== Hamburger button ===== */
.tg-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.tg-hamburger:hover { background: var(--tg-blue-light); }
.tg-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--tg-text);
    border-radius: 2px;
    transition: all 0.3s;
}
.tg-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.tg-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.tg-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ===== Lang Selector ===== */
.tg-lang-selector { position: relative; }
.tg-lang-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--tg-border); border-radius: 8px; background: white; font-size: 0.8rem; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.tg-lang-btn:hover { border-color: var(--tg-blue); background: var(--tg-bg-secondary); }
.tg-lang-btn i { font-size: 0.7rem; transition: transform 0.2s; }
.tg-lang-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; background: white; border: 1px solid var(--tg-border); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); z-index: 1000; max-height: 300px; overflow-y: auto; min-width: 160px; }
.tg-lang-dropdown.show { display: block; }
.tg-lang-option { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 0.85rem; cursor: pointer; transition: background 0.1s; white-space: nowrap; }
.tg-lang-option:hover { background: var(--tg-bg-secondary); }
.tg-lang-option.active { color: var(--tg-blue); font-weight: 600; }
.tg-lang-option:first-child { border-radius: 10px 10px 0 0; }
.tg-lang-option:last-child { border-radius: 0 0 10px 10px; }

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .tg-hamburger { display: flex; }
    .tg-nav-links {
        display: none !important;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 10px 16px 14px;
        border-bottom: 1px solid rgba(42, 171, 238, 0.12);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        z-index: 99;
        gap: 4px;
    }
    .tg-nav-links.open { display: flex !important; }
    .tg-navbar { position: relative; overflow: visible; }
    .tg-nav-btn { padding: 10px 14px; font-size: 0.9rem; border-radius: 10px; }
    .tg-nav-btn.active { text-align: left; }
    .tg-lang-selector { width: 100%; }
    .tg-lang-btn { width: 100%; justify-content: space-between; }
    .tg-lang-dropdown { width: 100%; position: static; box-shadow: none; border: 1px solid var(--tg-border); margin-top: 4px; }
}

@media (max-width: 768px) {
    .tg-hero-title { font-size: 1.5rem; }
    .tg-card-body { padding: 20px; }
    .tg-nav-user { display: none; }
    body::before, body::after { display: none; }
    .tg-flying-chars { display: none; }
}
