:root {
    --ocean-twilight: #2E49B8;
    --dark-amethyst: #241750;
    --black: #040107;
    --ink-black: #0B0514;
    --midnight-violet: #110721;
    --accent-blue: #4A6FE8;
    --accent-purple: #3D2870;
    --text-light: #FFFFFF;
    --text-dim: #B8B8D0;
    --success: #00C853;
    --error: #FF3B30;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--ink-black) 0%, var(--black) 50%, var(--midnight-violet) 100%);
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 300px;
    color: var(--text-light);
}

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

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #4A6FE8, var(--ocean-twilight), var(--dark-amethyst));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(46, 73, 184, 0.3);
}

.header p {
    font-size: 1.1em;
    opacity: 0.8;
    color: var(--text-dim);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    align-items: stretch;
}

.app-card {
    background: linear-gradient(135deg, rgba(36, 23, 80, 0.95), rgba(17, 7, 33, 0.95));
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(46, 73, 184, 0.3);
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(46, 73, 184, 0.2);
    border-color: var(--ocean-twilight);
}

.app-icon {
    background: linear-gradient(135deg, var(--ocean-twilight), var(--dark-amethyst));
    padding: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    flex-shrink: 0;
}

.app-icon-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 12px;
}

.app-icon-emoji {
    font-size: 70px;
    line-height: 1;
}

.app-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-name {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 12px;
    color: var(--text-light);
    min-height: 3em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-description {
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 0.9em;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    flex-shrink: 0;
}

.app-category {
    background: rgba(46, 73, 184, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--accent-blue);
    font-weight: 500;
}

.install-status {
    font-size: 0.85em;
    color: var(--success);
    font-weight: bold;
}

.console-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transition: transform 0.3s ease;
    z-index: 10000;
}

.console-panel.minimized {
    transform: translateY(calc(100% - 40px));
}

.console-header {
    cursor: pointer;
    height: 40px;
}

.console-btn {
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.console-header {
    pointer-events: auto;
}

.console-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 13px;
    color: var(--text-light);
}

.console-badge {
    background: var(--ocean-twilight);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: normal;
}

.console-badge.error {
    background: var(--error);
}

.console-badge.warning {
    background: #FF9800;
}

.console-badge.info {
    background: var(--accent-blue);
}

.console-controls {
    display: flex;
    gap: 8px;
}

.console-btn {
    background: var(--dark-amethyst);
    border: 1px solid var(--ocean-twilight);
    color: var(--text-dim);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.console-btn:hover {
    background: var(--ocean-twilight);
    color: white;
    transform: scale(1.05);
}

.console-content {
    height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: var(--black);
    font-size: 11px;
    line-height: 1.5;
}

.console-line {
    padding: 3px 8px;
    margin: 2px 0;
    border-left: 3px solid transparent;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

.console-line:hover {
    background: rgba(46, 73, 184, 0.1);
}

.console-line.console-log {
    border-left-color: #6c6c6c;
    color: var(--text-dim);
}

.console-line.console-info {
    border-left-color: var(--accent-blue);
    color: #90caf9;
}

.console-line.console-warning {
    border-left-color: #FF9800;
    color: #ffb74d;
}

.console-line.console-error {
    border-left-color: var(--error);
    color: #ef9a9a;
}

.console-line.console-success {
    border-left-color: var(--success);
    color: #a5d6a7;
}

.console-line.console-install {
    border-left-color: var(--ocean-twilight);
    color: #ce93d8;
}

.console-timestamp {
    color: #6c6c6c;
    margin-right: 10px;
    font-size: 10px;
}

.console-footer {
    background: var(--midnight-violet);
    padding: 5px 15px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    border-top: 1px solid var(--dark-amethyst);
}

.console-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.console-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.console-time {
    color: #6c6c6c;
}

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

.console-btn-danger:hover {
    background: #d32f2f;
}

/* Стиль для кнопки обновления (оранжевая) */
.install-btn.update {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 1, 7, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--dark-amethyst), var(--midnight-violet));
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--ocean-twilight);
}

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

.modal-header {
    background: linear-gradient(135deg, var(--ocean-twilight), var(--dark-amethyst));
    color: white;
    padding: 20px;
    text-align: center;
}

.modal-header h2 {
    font-size: 1.5em;
}

.modal-body {
    padding: 20px;
    color: var(--text-dim);
}

.app-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--ocean-twilight);
    line-height: 1.6;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.install-btn, .modal-close {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: 600;
}

.install-btn {
    background: linear-gradient(135deg, var(--ocean-twilight), var(--accent-purple));
    color: white;
    flex: 1;
}

.install-btn.uninstall {
    background: linear-gradient(135deg, var(--error), #D32F2F);
}

.modal-close {
    background: var(--midnight-violet);
    color: var(--text-dim);
    border: 1px solid var(--ocean-twilight);
}

.install-btn:hover, .modal-close:hover {
    transform: scale(1.05);
}

.install-btn:active, .modal-close:active {
    transform: scale(0.95);
}

.notification {
    position: fixed;
    bottom: 320px;
    right: 20px;
    background: var(--dark-amethyst);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--ocean-twilight);
}

.notification.show {
    transform: translateX(0);
}

/* Scrollbar */
.console-content::-webkit-scrollbar {
    width: 8px;
}

.console-content::-webkit-scrollbar-track {
    background: var(--black);
}

.console-content::-webkit-scrollbar-thumb {
    background: var(--ocean-twilight);
    border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--midnight-violet);
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--ocean-twilight);
    border-radius: 4px;
}

@media (hover: none) {
    .app-card:hover { transform: none; }
    .install-btn:hover, .modal-close:hover { transform: none; }
}

@media (min-width: 1920px) {
    .apps-grid { grid-template-columns: repeat(4, 1fr); gap: 30px; }
    .app-name { font-size: 1.5em; }
    .app-description { font-size: 1em; }
}

@media (max-width: 768px) {
    .apps-grid { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.8em; }
    .console-panel { font-size: 10px; }
    .console-content { height: 150px; }
    .notification { bottom: 270px; }
}


/* Консоль - ниже модального окна */
.console-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;  /* Уменьшаем z-index */
    pointer-events: none;  /* Консоль не перехватывает клики */
}

.console-header, .console-content, .console-footer, .console-btn {
    pointer-events: auto; /* Внутри консоли клики работают */
}

/* Модальное окно - выше консоли */
.modal {
    z-index: 2000;  /* Больше чем у консоли */
}

.modal-content {
    position: relative;
    z-index: 2001;
    margin-bottom: 60px;  /* Отступ от консоли */
}

/* Кнопки в модальном окне должны быть кликабельны */
.install-btn, .modal-close {
    position: relative;
    z-index: 2002;
}
