:root {
    --color-primary: #00ccff;
    --color-success: #00ff99;
    --color-warning: #ffcc00;
    --color-danger: #ff4757;
    --color-text: #ffffff;
    --color-bg: #0a0a2a;
    --color-bg-light: rgba(255, 255, 255, 0.05);
    --color-border: rgba(255, 255, 255, 0.1);
    --corp-bg-image: none; 
}

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

body {
    font-family: 'Arial', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

.container { 
    max-width: 1400px; 
    margin: 0 auto; 
    padding: 20px; 
}

/* ========== УНИВЕРСАЛЬНЫЕ СТИЛИ ДЛЯ ШАПКИ ========== */
.header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--color-bg-light);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.character-portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.3);
    flex-shrink: 0;
}

.character-info {
    min-width: 200px;
}

.character-info h1 { 
    color: var(--color-primary); 
    margin-bottom: 5px; 
    font-size: 1.5em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.character-info p { 
    color: #cccccc; 
}

.corp-alliance-logos {
    display: flex; 
    align-items: flex-end;
    margin-left: 20px;
    flex-shrink: 0;
}

.corp-logo {
    width: 120px; 
    height: 120px; 
    border-radius: 10px;
    z-index: 2;
}

.alliance-logo {
    width: 120px; 
    height: 120px; 
    border-radius: 8px;
    margin-left: -50px;
    z-index: 1;
}

/* Контейнер для кнопок навигации */
.header-actions-container {
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
    flex: 1 1 auto;
}

.header-actions { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    max-width: 800px;
}

/* EVE-стили кнопок */
.eve-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
}

.eve-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.eve-btn:hover::before {
    left: 100%;
}

.eve-btn-primary {
    background: linear-gradient(135deg, #00aaff, #0077cc);
    border-color: #00ccff;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 204, 255, 0.3);
}

.eve-btn-primary:hover {
    background: linear-gradient(135deg, #00bbff, #0088dd);
    border-color: #00ddff;
    box-shadow: 0 4px 12px rgba(0, 204, 255, 0.4);
    transform: translateY(-1px);
}

.eve-btn-secondary {
    background: linear-gradient(135deg, #444444, #222222);
    border-color: #666666;
    color: #cccccc;
    box-shadow: 0 2px 8px rgba(102, 102, 102, 0.2);
}

.eve-btn-secondary:hover {
    background: linear-gradient(135deg, #555555, #333333);
    border-color: #777777;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 102, 102, 0.3);
    transform: translateY(-1px);
}

.eve-btn-danger {
    background: linear-gradient(135deg, #ff4757, #cc3342);
    border-color: #ff6b7b;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 123, 0.3);
}

.eve-btn-danger:hover {
    background: linear-gradient(135deg, #ff5c6c, #dd3a4a);
    border-color: #ff7f8f;
    box-shadow: 0 4px 12px rgba(255, 107, 123, 0.4);
    transform: translateY(-1px);
}

.eve-btn-icon {
    font-size: 1.1em;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* Адаптация для средних экранов */
@media (max-width: 1400px) {
    .header-actions {
        max-width: 700px;
    }
    
    .eve-btn {
        padding: 8px 14px;
        font-size: 0.85em;
        gap: 4px;
    }
}

@media (max-width: 1200px) {
    .header-actions {
        max-width: 600px;
    }
    
    .eve-btn {
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

@media (max-width: 992px) {
    .header-actions {
        max-width: 500px;
        gap: 8px;
    }
    
    .eve-btn {
        padding: 7px 10px;
        font-size: 0.75em;
    }
    
    .eve-btn-icon {
        font-size: 1em;
        margin-right: 2px;
    }
}

@media (max-width: 860px) {
    .header-actions {
        max-width: 420px;
    }
}

/* Sync Info */
.sync-info {
    background: rgba(0,255,0,0.1);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--color-success);
}

.sync-error {
    background: rgba(255,0,0,0.1);
    border-left: 4px solid var(--color-danger);
}

/* Active Stats Bar */
.active-stats-bar {
    background: var(--color-bg-light); 
    padding: 20px; 
    border-radius: 12px;
    margin: 20px 0; 
    border-left: 4px solid var(--color-success);
}

.stats-row {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px;
    margin-bottom: 15px;
}

.stats-item {
    background: rgba(0, 0, 0, 0.2); 
    padding: 15px; 
    border-radius: 8px;
}

.stats-header {
    display: flex; 
    align-items: center; 
    gap: 10px;
    margin-bottom: 10px; 
    color: var(--color-primary);
}

.stats-values {
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 10px;
}

.stats-value {
    text-align: center; 
    padding: 8px; 
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.value-number { 
    font-weight: bold; 
    font-size: 1.1em; 
}

.value-label { 
    font-size: 0.8em; 
    color: #cccccc; 
}

/* Color variations for different stat types */
.active-stats-bar .stat-value.warning { color: var(--color-warning); }
.active-stats-bar .stat-value.success { color: var(--color-success); }
.active-stats-bar .stat-value.danger { color: var(--color-danger); }
.active-stats-bar .stat-value.primary { color: var(--color-primary); }

/* Filters */
.filters {
    background: var(--color-bg-light); 
    padding: 20px; 
    border-radius: 15px;
    margin: 20px 0; 
    border: 1px solid var(--color-border);
}

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

.filter-group { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}

.filter-label { 
    color: var(--color-primary); 
    font-weight: bold; 
}

.filter-select {
    padding: 10px; 
    border: 1px solid var(--color-border); 
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3); 
    color: var(--color-text);
    width: 100%;
}

.filter-select option {
    background: #1a1e2a;
    color: white;
}

.btn-apply { 
    padding: 12px 25px; 
    background: var(--color-primary); 
    color: white;
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold;
    transition: transform 0.2s;
}

.btn-apply:hover {
    transform: translateY(-2px);
    background: linear-gradient(45deg, var(--color-primary), #0088ff);
}

.btn-clear {
    padding: 12px 25px;
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: #777;
    transform: translateY(-2px);
}

/* Contracts Grid */
.contracts-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px; 
    margin: 30px 0;
}

.contract-card {
    background: var(--color-bg-light); 
    padding: 20px; 
    border-radius: 12px;
    border: 1px solid var(--color-border); 
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.contract-card:hover {
    transform: translateY(-3px); 
    border-color: var(--color-primary);
    box-shadow: 0 5px 20px rgba(0, 204, 255, 0.2);
}

.contract-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: start;
    margin-bottom: 15px; 
    padding-bottom: 10px; 
    border-bottom: 1px solid var(--color-border);
    position: relative;
    z-index: 1;
}

.contract-type { 
    font-size: 1.1em; 
    font-weight: bold; 
    color: var(--color-primary); 
    display: flex;
    align-items: center;
    gap: 5px;
}

.corp-badge {
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 215, 0, 0.2);
}

.taken-badge {
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(76, 175, 80, 0.2);
}

.contract-status { 
    padding: 4px 12px; 
    border-radius: 15px; 
    font-size: 0.8em; 
    font-weight: bold; 
    position: relative;
    z-index: 1;
}

.status-active { 
    background: var(--color-success); 
    color: #000; 
}

.status-progress { 
    background: var(--color-warning); 
    color: #000; 
}

.status-completed { 
    background: #00bfff; 
    color: #000; 
}

.status-cancelled { 
    background: var(--color-danger); 
    color: #fff; 
}

.status-deleted { 
    background: #666; 
    color: #fff; 
}

/* Issuer Info */
.issuer-info {
    display: flex; 
    align-items: center; 
    gap: 10px;
    margin-bottom: 1px; 
    padding: 10px;
    background: rgba(0, 0, 0, 0.2); 
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

.issuer-portrait {
    width: 40px; 
    height: 40px; 
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    flex-shrink: 0;
}

.issuer-details {
    flex: 1;
    min-width: 0;
}

.issuer-name {
    font-weight: bold; 
    color: var(--color-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.issuer-type {
    font-size: 0.8em; 
    color: #cccccc;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.acceptor-info {
    margin-top: 5px;
    font-size: 0.85em;
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.issuer-logos {
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
}

.issuer-corp-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    z-index: 2;
}

.issuer-alliance-logo {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    margin-left: -15px;
    margin-bottom: 0px;
    z-index: 1;
}

/* Contract Details */
.contract-details { 
    display: flex;
    flex-direction: column;
    gap: 10px; 
    margin-bottom: 15px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.contract-detail { 
    display: flex; 
    justify-content: space-between; 
}

.detail-label { 
    color: #cccccc; 
}

.detail-value { 
    font-weight: bold; 
}

.detail-value.isk { 
    color: var(--color-success); 
}

.detail-value.volume { 
    color: var(--color-warning); 
}

.detail-value.collateral {
    color: var(--color-danger);
}

/* Station Info */
.station-info { 
    background: rgba(0, 0, 0, 0.2); 
    padding: 12px; 
    border-radius: 8px;
    border-left: 3px solid var(--color-primary);
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.station-row {
    display: flex; 
    align-items: center;
    margin: 6px 0; 
    padding: 4px 0;
}

.station-row .detail-label {
    min-width: 60px;
    flex-shrink: 0;
}

.station-name {
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    max-width: 200px; 
    font-weight: bold; 
    color: var(--color-warning);
    margin-right: 4px;
    flex: 1;
}

.station-type {
    font-size: 0.8em; 
    color: #888; 
    white-space: nowrap;
    flex-shrink: 0;
}

/* Contract Footer */
.contract-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding-top: 15px; 
    border-top: 1px solid var(--color-border);
    margin-top: 15px;
    position: relative;
    z-index: 1;
}

.contract-date { 
    color: #cccccc; 
    font-size: 0.9em; 
}

.contract-items-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 1.1em;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    position: relative;
}

.contract-items-btn:hover {
    background: rgba(0, 136, 204, 0.2);
}

.contract-items-btn.has-items {
    color: var(--color-success);
}

.items-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-danger);
    color: white;
    font-size: 0.7em;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 15px;
    text-align: center;
}

.contract-id { 
    color: #666; 
    font-size: 0.8em; 
    font-family: monospace;
}

/* Корпоративные контракты */
.contract-card.corp-contract {
    position: relative;
    border: 2px solid #4a4a8a;
    background-size: 40% 40% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    opacity: 0.9;
}

.contract-card.corp-contract::after {
    content: '🏢 Корпоративный';
    position: absolute;
    top: 60px;
    left: 20px;
    background: rgba(74, 74, 138, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
}

/* Loading and Error States */
.loading, .error, .empty-state {
    text-align: center; 
    padding: 40px; 
    grid-column: 1 / -1;
}

.error { 
    color: var(--color-danger); 
}

.empty-state { 
    color: #cccccc; 
}

/* Статистика по фильтру */
.stats-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.stat-mini-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.stat-mini-card:hover {
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.3);
}

.stat-mini-icon {
    font-size: 1.2em;
    opacity: 0.7;
    min-width: 20px;
    text-align: center;
}

.stat-mini-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.stat-mini-value {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--color-success);
}

.stat-mini-label {
    font-size: 0.65em;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

.stat-mini-card.corp {
    background: rgba(255,215,0,0.05);
    border: 1px solid rgba(255,215,0,0.2);
}

.stat-mini-card.corp:hover {
    background: rgba(255,215,0,0.1);
}

.stat-value-small {
    font-weight: bold;
    font-size: 1.1em;
}

.stat-value-small.isk {
    color: var(--color-success);
}

.stat-value-small.collateral {
    color: var(--color-danger);
}

/* Footer Copyright */
.footer-copyright {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.copyright-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 25px;
    border: 1px solid rgba(74, 74, 138, 0.3);
    backdrop-filter: blur(10px);
    animation: glow 3s ease-in-out infinite;
}

.copyright-text {
    font-size: 12px;
    color: #888;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.wigoh-logo {
    font-size: 16px;
    font-weight: bold;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(45deg, var(--color-primary), var(--color-success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.copyright-symbol {
    font-size: 10px;
    color: var(--color-success);
    vertical-align: super;
    margin-left: -4px;
}

.copyright-year {
    font-size: 12px;
    color: #666;
    font-weight: 300;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(74, 74, 138, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(74, 74, 138, 0.5);
    }
    100% {
        box-shadow: 0 0 5px rgba(74, 74, 138, 0.3);
    }
}

/* Адаптивность */
@media (max-width: 1200px) {
    .station-name { 
        max-width: 150px; 
    }
}

@media (max-width: 1024px) {
    .station-name { 
        max-width: 120px; 
    }
}

@media (max-width: 900px) {
    .corp-logo { 
        width: 100px; 
        height: 100px; 
    }
    
    .alliance-logo { 
        width: 80px; 
        height: 80px; 
        margin-left: -30px; 
    }
    
    .character-info h1 {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions-container {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }
    
    .header-actions {
        max-width: 100%;
        justify-content: center;
        margin: 15px 0 0 0;
    }
    
    .corp-alliance-logos { 
        margin: 15px 0; 
        justify-content: center; 
    }
    
    .character-info h1 {
        max-width: 100%;
    }
    
    .filters-grid { 
        grid-template-columns: 1fr; 
    }
    
    .contracts-grid { 
        grid-template-columns: 1fr; 
    }
    
    .stats-row { 
        grid-template-columns: 1fr; 
    }
    
    .stats-values { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .stats-mini-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .station-name { 
        max-width: 100%; 
    }
    
    .corp-logo { 
        width: 80px; 
        height: 80px; 
    }
    
    .alliance-logo { 
        width: 60px; 
        height: 60px; 
        margin-left: -20px; 
    }
    
    .issuer-info {
        flex-wrap: wrap;
    }
    
    .issuer-logos {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .station-row {
        flex-wrap: wrap;
    }
    
    .station-name {
        white-space: normal;
        word-break: break-word;
        max-width: 100%;
    }
    
    .footer-copyright {
        margin-top: 30px;
        padding: 15px 0;
    }
    
    .copyright-content {
        padding: 10px 20px;
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 600px) {
    .header-actions {
        max-width: 100%;
        gap: 6px;
    }
    
    .eve-btn {
        flex: 0 1 auto;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header-actions {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        width: 100%;
    }
    
    .eve-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.85em;
    }
    
    .stats-mini-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1800px) {
    .header-actions {
        max-width: 900px;
    }
}

/* Debug Info */
.debug-info {
    position: fixed; 
    bottom: 10px; 
    right: 10px; 
    background: rgba(0,0,0,0.7); 
    color: #ccc; 
    padding: 8px 12px; 
    border-radius: 5px; 
    font-size: 11px;
    z-index: 1000; 
    backdrop-filter: blur(5px);
}