@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: #2d1b4e;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Верхнее меню */
.top-menu {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.menu-items {
    display: flex;
    gap: 8px;
    align-items: center;
}

.menu-item {
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 10px;
    display: none;
    font-weight: 500;
    font-size: 14px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.user-info button {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

#login-btn {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#login-btn:hover {
    /* background: rgba(255, 255, 255, 0.3); */
    /* background: linear-gradient(135deg, #f7f7f7 0%, #8f80fc 100%);; */
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce770 100%);;

    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#logout-btn {
    background: rgba(231, 76, 60, 0.8);
    color: white;
}

#logout-btn:hover {
    background: rgba(231, 76, 60, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Кнопки */
.btn-primary {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(162, 155, 254, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(162, 155, 254, 0.4);
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
}

/* Основной контент */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Карточки */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(108, 92, 231, 0.25);
}

.card h1,
.card h2 {
    margin-bottom: 20px;
    color: #6c5ce7;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.5px;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #6c5ce7;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    
    height: 50px;
    border: none;
    border-radius: 5px;
    cursor: pointer;

    padding: 12px 16px;
    border: 2px solid rgba(108, 92, 231, 0.2);
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    color: #2d1b4e;
    font-family: 'Inter', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
    background: white;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(108, 92, 231, 0.4);
}

/* Popup стили */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 27, 78, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

/* Вложенные попапы должны быть поверх обычных */
.popup-overlay.nested-popup {
    z-index: 10001;
}

.popup-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: popupFadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(108, 92, 231, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 2px solid rgba(108, 92, 231, 0.1);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1;
    border-radius: 24px 24px 0 0;
}

.popup-header h3 {
    margin: 0;
    color: #6c5ce7;
    font-weight: 700;
    font-size: 22px;
}

.popup-close {
    background: rgba(108, 92, 231, 0.1);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c5ce7;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-weight: 300;
}

.popup-close:hover {
    color: white;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    transform: rotate(90deg) scale(1.1);
}

.popup-body {
    padding: 30px;
}

.popup-footer {
    padding: 24px 30px;
    border-top: 2px solid rgba(108, 92, 231, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0 0 24px 24px;
}

/* Утилиты */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.contact-item {
    animation: fadeIn 0.2s ease-out;
}

/* Ad Types Tab Styles */
.ad-types-management {
    padding: 20px 0;
}

.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.table-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    border-radius: 20px;
}

.ad-types-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1000px;
}

.ad-types-table th,
.ad-types-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(108, 92, 231, 0.1);
    font-size: 14px;
    transition: all 0.2s ease;
}

.ad-types-table th {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1) 0%, rgba(162, 155, 254, 0.1) 100%);
    font-weight: 700;
    color: #6c5ce7;
    position: sticky;
    top: 0;
    border-bottom: 2px solid rgba(108, 92, 231, 0.2);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    z-index: 10;
}

.ad-types-table tbody tr {
    transition: all 0.2s ease;
}

.ad-types-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.05);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.1);
}

.ad-types-table tbody tr:nth-child(even) {
    background: rgba(108, 92, 231, 0.02);
}

.ad-types-table tbody tr:nth-child(even):hover {
    background: rgba(108, 92, 231, 0.08);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    display: inline-block;
    text-align: center;
    min-width: 80px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-active { 
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    box-shadow: 0 2px 8px rgba(0, 184, 148, 0.3);
}
.status-inactive { 
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    box-shadow: 0 2px 8px rgba(162, 155, 254, 0.3);
}

.project-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
}

.ad-type-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.ad-type-action-btn {
    background: rgba(108, 92, 231, 0.1);
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    color: #6c5ce7;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.ad-type-action-btn:hover {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.ad-type-action-btn.delete:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.url-cell {
    max-width: 200px;
}

.url-cell a {
    color: #6c5ce7;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.url-cell a:hover {
    color: #a29bfe;
    text-decoration: underline;
}

.copy-btn-small {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 10px;
    margin-left: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(108, 92, 231, 0.3);
}

.copy-btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.4);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.1);
}

#page-info {
    font-weight: 600;
    color: #6c5ce7;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 10px;
}

.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: rgba(108, 92, 231, 0.6);
    font-style: italic;
    font-size: 16px;
}

.loading-state {
    text-align: center;
    padding: 40px;
    color: #6c5ce7;
    font-weight: 500;
}

/* Адаптивность */
@media (max-width: 768px) {
    /* Верхнее меню */
    .top-menu {
        padding: 0 15px;
        height: 60px;
        position: relative;
    }
    
    .menu-toggle {
        display: flex;
        order: 1;
    }
    
    .menu-items {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
        flex-direction: column;
        gap: 0;
        padding: 0;
        box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
        display: none;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .menu-items.menu-open {
        display: flex;
    }
    
    .menu-item {
        display: block;
        width: 100%;
        padding: 15px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: left;
        font-size: 14px;
        border-radius: 0;
    }
    
    .menu-item:last-child {
        border-bottom: none;
    }
    
    .user-info {
        order: 2;
        margin-left: auto;
    }
    
    .user-info span {
        font-size: 13px;
        display: none;
    }
    
    .user-info button {
        padding: 8px 15px;
        font-size: 12px;
    }
    
    /* Основной контент */
    .content {
        padding: 15px;
    }
    
    /* Карточки */
    .card {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 16px;
    }
    
    .card h1,
    .card h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    /* Формы */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 14px;
        height: 45px;
    }
    
    /* Кнопки */
    .btn-primary {
        padding: 10px 20px;
        font-size: 13px;
        width: 100%;
    }
    
    .btn-secondary {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    /* Popup */
    .popup-content {
        width: 95%;
        max-width: none;
        border-radius: 20px;
    }
    
    .popup-header {
        padding: 20px;
    }
    
    .popup-header h3 {
        font-size: 18px;
    }
    
    .popup-body {
        padding: 20px;
    }
    
    .popup-footer {
        padding: 20px;
        flex-direction: column;
    }
    
    .popup-footer button {
        width: 100%;
    }
    
    /* Фильтры */
    .filters-container {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 15px;
    }
    
    .filters-container .form-group {
        grid-column: span 1 !important;
        margin-bottom: 0;
    }
    
    /* Таблицы */
    .ad-types-table {
        font-size: 12px;
    }
    
    .ad-types-table th,
    .ad-types-table td {
        padding: 8px 10px;
    }
}

/* Стили для длинных URL */
.truncate-url {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}