html {
    overflow-x: hidden;
    width: 100%;
    -webkit-text-size-adjust: 100%;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.header {
    background: rgba(10, 10, 20, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.2rem 2rem;
    position: relative;
    min-height: 70px;
}

.main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin: 0;
    text-decoration: none;
    transition: all 0.3s ease;
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    letter-spacing: 1px;
}

.logo:hover {
    background: linear-gradient(45deg, #C0C0C0, #E8E8E8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(-50%) scale(1.05);
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    position: absolute;
    right: 5.7rem;
    top: 50%;
    transform: translateY(-50%);
}

.rewards-link {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.rewards-link:hover,
.rewards-link.active {
    color: white;
    background: rgba(102, 126, 234, 0.35);
    border-color: rgba(160, 174, 255, 0.8);
    transform: translateY(-50%) scale(1.08);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.profile-avatar:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.2);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: #161625;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 8px;
    min-width: 190px;
    z-index: 2100;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform-origin: top right;
    animation: dropdownFade 0.2s ease-out;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-dropdown.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.btn.primary {
    background: linear-gradient(45deg, #B8B8B8 0%, #D3D3D3 50%, #C0C0C0 100%);
    color: #2c2c2c;
    font-weight: 600;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(192, 192, 192, 0.3);
    background: linear-gradient(45deg, #D3D3D3 0%, #E8E8E8 50%, #C9C9C9 100%);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.btn.danger {
    background: #f44336;
    color: white;
}

.btn.danger:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.welcome-section {
    text-align: center;
    margin-bottom: 3rem;
}

.welcome-content h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: white;
}

.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
}

.input-group select option {
  background: rgba(26, 26, 46, 0.95);
  color: white;
}

select option {
  background: #1a1a2e;
  color: white;
}

.input-group select optgroup {
  background: rgba(26, 26, 46, 0.95);
  color: white;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.generate-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-section {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    z-index: 1000;
    max-width: 400px;
}

.error-content h3 {
    margin-bottom: 0.5rem;
}

.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.credits-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 2002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.credits-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-icon::before {
    content: "💰";
}

.credits-amount {
    font-weight: bold;
}

.site-footer {
    text-align: center;
    padding: 18px 0;
    color: #aaa;
    font-size: 0.85rem;
    border-top: 1px solid #2a2a2a;
    margin-top: auto;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    color: #d0d0d0;
}

.mobile-menu-toggle, .mobile-sidebar, .sidebar-overlay {
    display: none;
}

.notification-bell {
    position: absolute;
    right: 145px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 2001;
}

.bell-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.bell-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.bell-icon svg {
    color: white;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #f44336;
    border-radius: 50%;
    border: 2px solid #1a1a2e;
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 350px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 2002;
    overflow: hidden;
    transform-origin: top right;
}

.notification-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 600;
}

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-notification-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 768px) {
    .close-notification-btn {
        display: block;
    }

    .notification-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) scale(0.9) !important;
        width: 90% !important;
        max-width: 400px !important;
        max-height: 80vh !important;
        margin: 0 !important;
        z-index: 5000 !important;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .notification-dropdown.show {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translate(-50%, -50%) scale(1) !important;
    }

    .notification-dropdown-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(5px);
        z-index: 4900;
    }

    .notification-dropdown-overlay.show {
        display: block;
    }
}

.mark-all-read-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.mark-all-read-btn:hover {
    color: white;
}

.notification-list {
    max-height: 340px;
    overflow-y: auto;
}

.notification-loading {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item.unread {
    background: rgba(102, 126, 234, 0.1);
}

.notification-item.unread:hover {
    background: rgba(102, 126, 234, 0.15);
}

.notification-title {
    color: white;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.notification-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.notification-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.no-notifications {
    padding: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.important-notifications {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(360px, calc(100vw - 40px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
    pointer-events: none;
}

.important-notification {
    position: relative;
    padding: 16px 42px 15px 16px;
    background: rgba(13, 13, 27, 0.97);
    border: 1px solid rgba(102, 126, 234, 0.7);
    border-left: 4px solid #667eea;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    pointer-events: auto;
    animation: importantNotificationIn 0.25s ease-out;
}

.important-notification:hover {
    background: rgba(24, 24, 46, 0.98);
}

.important-notification:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.important-notification-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    line-height: 24px;
    cursor: pointer;
}

.important-notification-close:hover {
    color: white;
}

.important-notification-title {
    margin-bottom: 5px;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.important-notification-description {
    margin-bottom: 7px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    line-height: 1.4;
}

.important-notification-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

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

@media (max-width: 768px) {
    .important-notifications {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
    }
}

.notification-list::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

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

@media (max-width: 768px) {
    .header {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.1) url('/img/header-button.png') no-repeat center;
        background-size: 30px;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 12px;
        cursor: pointer;
        z-index: 3000;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }

    .mobile-sidebar {
        display: block;
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        background: #0a0a14;
        z-index: 4000;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        overflow-y: auto;
    }

    .mobile-sidebar.show {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 3500;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .sidebar-header {
        padding: 2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .sidebar-logo {
        font-size: 1.5rem;
        font-weight: 800;
        color: white;
    }

    .close-sidebar {
        font-size: 2rem;
        color: rgba(255, 255, 255, 0.6);
        cursor: pointer;
    }

    .sidebar-content {
        padding: 1.5rem;
    }

    .sidebar-user-info {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .sidebar-username {
        font-weight: 600;
        font-size: 1.1rem;
        color: white;
    }

    .sidebar-credits {
        font-size: 0.9rem;
        font-weight: 700;
        background: linear-gradient(45deg, #B8B8B8, #D3D3D3);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        margin-top: 2px;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .sidebar-credits .credits-icon::before {
        content: "💰";
        -webkit-text-fill-color: initial;
        background-clip: initial;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .sidebar-link {
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        padding: 0.8rem 1rem;
        border-radius: 8px;
        font-weight: 500;
        transition: all 0.2s ease;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar-link:hover {
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }

    .sidebar-link.logout {
        color: #f44336;
        margin-top: 1rem;
    }

    .main {
        padding: 1rem;
        padding-top: 5rem;
    }

    .welcome-content h2 {
        font-size: 2rem;
    }
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.completion-popup {
    background: rgba(20, 20, 35, 0.95);
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: popupSlideIn 0.3s ease-out;
}

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

.completion-popup h3 {
    margin-bottom: 20px;
    font-size: 24px;
    color: white;
}

.completion-popup p {
    margin-bottom: 20px;
    color: #ccc;
    font-size: 16px;
}

.completion-popup button {
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.completion-popup .primary-btn {
    background: #007bff;
    color: white;
}

.completion-popup .primary-btn:hover {
    background: #0056b3;
}

.completion-popup .secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.completion-popup .secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.completion-popup .danger-btn {
    background: #dc3545;
    color: white;
}

.completion-popup .danger-btn:hover {
    background: #c82333;
}

.rejection-popup h3 {
    color: #ff4d4d;
}

.credits-backend-popup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 20000;
}

.credits-backend-popup {
    width: min(420px, 100%);
    padding: 2rem;
    border: 1px solid rgba(255, 120, 120, 0.5);
    border-radius: 12px;
    background: #161625;
    color: white;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.credits-backend-popup h3 {
    margin-bottom: 1rem;
    color: #ff7676;
    font-size: 1.35rem;
}

.credits-backend-popup p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.credits-backend-popup-overlay.backend-recovered {
    background: rgba(0, 35, 15, 0.55);
}

.credits-backend-popup-overlay.backend-recovered .credits-backend-popup {
    border-color: rgba(80, 220, 130, 0.65);
    background: #12281b;
}

.credits-backend-popup-overlay.backend-recovered .credits-backend-popup h3 {
    color: #6ee7a0;
}

.credits-backend-popup-overlay.backend-recovered .credits-backend-popup p {
    color: rgba(220, 255, 230, 0.9);
}
