@import "./tokens.css";

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
    margin-top: 0;
    color: var(--primary);
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 24px;
    margin: 20px 0;
}

h3 {
    font-size: 20px;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 8px;
}

.tab {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab.active {
    background: var(--secondary);
    color: var(--text-light);
    border-color: var(--secondary);
}

.tab:hover:not(.active) {
    background: var(--border);
}

.tab-button {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    min-height: 44px;
}

.tab-button:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.survey-btn {
    margin: 16px auto;
    display: block;
    max-width: 200px;
}

/* ===== INFO BANNER ===== */
.info-banner {
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--secondary);
    padding: 20px;
    margin: 24px 0;
    border-radius: var(--radius);
}

.info-banner p {
    margin: 8px 0;
    color: var(--text-accent);
    font-weight: 600;
}

.info-banner-left {
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    padding-left: 20px;
    position: relative;
}

.info-banner-left::before {
    content: "•";
    position: absolute;
    left: 0;
}

/* ===== SCHEMES SECTION ===== */
.content-section {
    display: none;
    animation: slideUp 0.3s ease;
}

.content-section.active {
    display: block;
}

.section {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.item:hover {
    box-shadow: var(--shadow-hover);
}

.item > div:first-child {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--secondary);
}

.item img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

/* ===== PATHS SECTION ===== */
.section-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.list-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.list-item ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list-item li {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    font-weight: 500;
}

.list-item li:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.copy-icon {
    opacity: 0.7;
    transition: all 0.3s;
}

.list-item li:hover .copy-icon {
    opacity: 1;
    transform: scale(1.1);
}

.list-item li.copied {
    animation: pulse 0.5s ease;
}

.list-item li.copied .copy-icon {
    opacity: 0;
}

.list-item li.copied::after {
    content: "✅";
    position: absolute;
    right: 12px;
    animation: fadeIn 0.3s ease;
}

/* ===== PLAYERS TABLE ===== */
.table-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.table-wrapper {
    overflow-x: auto;
}

#playersTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

#playersTable th {
    background: var(--primary);
    color: var(--text-on-secondary);
    padding: 16px 12px;
    text-align: left;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    position: sticky;
    top: 0;
}

#playersTable td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

/* Подсветка строки при наведении */
#playersTable tr:hover {
    background-color: rgba(52, 152, 219, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateX(4px);
}

/* Чётные строки для лучшей читаемости */
#playersTable tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.01);
}

#playersTable tr:nth-child(even):hover {
    background-color: rgba(52, 152, 219, 0.12);
}

.actions-column {
    min-width: 100px;
}

.action-btn {
    padding: 6px 12px;
    margin: 0 4px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.action-btn:hover {
    transform: scale(1.05);
}

.edit-btn {
    background: var(--secondary);
    color: white;
}

.delete-btn {
    background: var(--accent);
    color: white;
}

/* ===== COLOR CODING FOR LEVELS ===== */
.level-13-12 {
    color: var(--success);
    font-weight: 600;
}

.level-12-13 {
    color: var(--warning);
    font-weight: 600;
}

.level-low {
    color: var(--text-secondary);
}

.level-unknown {
    color: var(--accent);
}

/* ===== LIGHTBOX ===== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius);
    min-width: 400px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-content .close:hover {
    color: var(--accent);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ===== BUTTONS ===== */
.button {
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button--primary {
    background: var(--secondary);
    color: var(--text-light);
}

.button--secondary {
    background: var(--text-secondary);
    color: var(--text-on-secondary);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.button:active {
    transform: translateY(0);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== NOTIFICATIONS ===== */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.notification {
    padding: 16px 20px;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--accent);
}

.notification.info {
    background: var(--secondary);
}

.notification.warning {
    background: var(--warning);
}

.notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* ===== LOADER ===== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 4000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--secondary);
    animation: spin 1s linear infinite;
}

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* Добавьте в конец файла styles.css */

.paths-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    width: 100%;
}

.paths-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary);
}

.paths-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.paths-list li {
    transition: all 0.2s;
}

.paths-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-icon {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.paths-list li:hover .copy-icon {
    opacity: 1;
}

/* ===== HEADER WITH FLAG ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.flag-container {
    width: fit-content;
}

.flag {
    width: 300px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.flag:hover {
    transform: scale(1.05);
}

.main-title {
    text-align: center;
    margin: 0;
    color: var(--primary);
    font-size: 32px;
    font-weight: bold;
    width: fit-content;
    flex-grow: 1;
}

.header-item {
    display: inline-grid;
    grid-template-columns: repeat(2, auto);
    align-items: center;
    justify-content: end;
}

@media (max-width: 946px) {
    .flag-container {
        order: 1;
    }
}

@media (max-width: 768px) {
    .header {
        justify-content: start;
    }
    .flag {
        width: 150px;
    }
    .main-title {
        font-size: 24px;
    }
}

@media (max-width: 468px) {
    .header {
        flex-direction: column;
        align-items: start;
    }
}

/* ===== STATUS STYLES ===== */
.status-active {
    color: var(--success);
    font-weight: 600;
}

.status-vacation {
    color: var(--warning);
    font-weight: 600;
}

.status-inactive {
    color: var(--accent);
    font-weight: 600;
}

.status-unknown {
    color: var(--text-secondary);
}

/* ===== TEXTAREA STYLES ===== */
.form-input textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
    padding: 10px 12px;
    font-family: inherit;
}

/* ===== TABLE SCROLLING ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== MOBILE TABLE OPTIMIZATION ===== */
@media (max-width: 768px) {
    #playersTable {
        font-size: 14px;
    }

    #playersTable th,
    #playersTable td {
        padding: 8px 6px;
    }
}

/* ===== FORM LAYOUT ===== */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-column {
    flex: 1;
    min-width: 0;
}

/* Mobile styles for form */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .form-column {
        width: 100%;
    }
}

/* ===== TABLE NUMBERING ===== */
.table-number {
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    min-width: 40px;
    padding: 10px 8px;
}

#playersTable th:first-child {
    text-align: center;
    min-width: 40px;
}

/* ===== SOCIAL LINKS ===== */
.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.social-link:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    border-color: #3498db;
}

.social-icon {
    font-size: 20px;
}

.social-text {
    white-space: nowrap;
}

/* ===== CONTACTS SECTION ===== */
.contacts-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow);
}

.contacts-section h2 {
    text-align: center;
    margin-bottom: 20px;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.contact-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.contact-icon {
    font-size: 28px;
    min-width: 40px;
    text-align: center;
}

.contact-info {
    flex: 1;
}

.contact-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.contact-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .social-links {
        flex-direction: column;
    }

    .social-link {
        width: 100%;
        justify-content: center;
    }
}

/* THEME CHANGE CONTROLS */
.theme-picker-container {
    display: flex;
    max-width: 100%;
    padding: 0 0;
    width: auto;
}

.theme-picker-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    outline: none;
    background: inherit;
    box-shadow: none;
    display: block;
    padding: 12px 24px;
    margin: 0;
    font: inherit;
    color: inherit;
    width: 100%;
    cursor: pointer;
    box-sizing: border-box;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.theme-picker-select select::-ms-expand {
    display: none;
}

.theme-icon {
    margin-right: 10px;
}

/* PROFILE */
.profile-item {
    background: var(--bg-secondary);
    border-radius: 24px;
    min-height: 44px;
    display: grid;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    grid-template-columns: repeat(2, auto);
    align-items: center;
    justify-content: space-between;
}

.profile-icon {
    width: 40px;
    height: 40px;
    margin: 8px 0;
    aspect-ratio: 1 / 1;
    border-radius: 100%;
    object-fit: cover;
}

.profile-text {
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    margin-right: 8px;
    color: var(--text-primary);
}

.skeleton {
    opacity: .7;
    animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
    0% {
        background-color: hsl(200, 20%, 70%);
    }

    100% {
        background-color: hsl(200, 20%, 95%);
    }
}

.skeleton-text {
    height: 20px;
    margin-right: 6px;
    border-radius: 24px;
    aspect-ratio: 4 / 1 ;
}

.profile-item.loading {
    display: none;
    pointer-events: none;
}

.profile-item.placeholder {
    display: none;
}

.profile-item.loading + .placeholder {
    display: inline-grid;
}

.profile-item.tab-button,
.profile-item.placeholder {
    padding: 0 24px;
}
