/* Zmienne CSS - Motywy i kolory bazowe */
:root {
    --bg-color: #0d0d0d;
    --panel-bg: rgba(20, 20, 20, 0.6);
    --text-color: #ffffff;
    --primary-color: #00ffff; /* Cyan */
    --secondary-color: #40e0d0; /* Turkus */
    --graphite: #2b2b2b;
    --border-color: rgba(0, 255, 255, 0.2);
    --glass-blur: blur(12px);
    --shadow-neon: 0 0 10px rgba(0, 255, 255, 0.5);
    --transition-speed: 0.3s;
    --border-radius: 12px;
}

/* Motyw Cyberpunk (Domyślny) */
.theme-cyber {
    --bg-color: #0a0a12;
    --panel-bg: rgba(15, 15, 25, 0.8);
    --primary-color: #00ffcc;
    --border-color: #00ffcc;
    --shadow-neon: 0 0 15px rgba(0, 255, 204, 0.6);
}

/* Motyw Dark */
.theme-dark {
    --bg-color: #121212;
    --panel-bg: rgba(30, 30, 30, 0.8);
    --primary-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow-neon: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Motyw Light */
.theme-light {
    --bg-color: #f0f0f0;
    --panel-bg: rgba(255, 255, 255, 0.8);
    --text-color: #111111;
    --primary-color: #0055ff;
    --border-color: #cccccc;
    --shadow-neon: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Reset i podstawowe ustawienia */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    background-image: radial-gradient(circle at top left, rgba(0, 255, 204, 0.12), transparent 30%), radial-gradient(circle at bottom right, rgba(64, 224, 208, 0.16), transparent 35%);
}

/* Klasy pomocnicze */
.hidden { display: none !important; }
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: panelFloat 0.7s ease both;
}

/* Ekran Startowy */
.splash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}
.splash-content { text-align: center; }
.logo-icon { font-size: 5rem; animation: pulse 2s infinite; }
.splash-title { font-size: 4rem; color: var(--primary-color); text-shadow: var(--shadow-neon); margin: 10px 0; }
.splash-subtitle { font-size: 1.5rem; margin-bottom: 20px; }

.language-selector {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.language-selector label {
    font-size: 1rem;
    opacity: 0.85;
}

.lang-select {
    min-width: 220px;
    padding: 10px 16px;
    font-size: 1rem;
    color: var(--text-color);
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    outline: none;
    transition: box-shadow var(--transition-speed);
}

.lang-select:hover,
.lang-select:focus {
    box-shadow: var(--shadow-neon);
}

/* Przycisk Neonowy */
.btn-neon {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 15px 40px;
    font-size: 1.2rem;
    text-transform: uppercase;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    box-shadow: var(--shadow-neon);
}
.btn-neon:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--primary-color);
}

/* Układ Główny */
#app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
    min-height: 0;
}

/* Menu Boczne */
#sidebar {
    width: 250px;
    display: flex;
    flex-direction: column;
    padding: 20px;
}
.sidebar-header { margin-bottom: 20px; text-align: center; color: var(--primary-color); text-shadow: var(--shadow-neon); }
.menu-list { list-style: none; }
.menu-list li { margin-bottom: 10px; }
.menu-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 12px;
    text-align: left;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--transition-speed), color var(--transition-speed);
}
.menu-btn:hover, .menu-btn.active {
    background: var(--primary-color);
    color: #000;
    box-shadow: var(--shadow-neon);
}

/* Zawartość Główna */
#main-content {
    flex: 1;
    position: relative;
    min-width: 0;
}
.panel {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed);
    overflow-y: auto;
    min-height: 0;
}
.panel.active {
    opacity: 1;
    pointer-events: all;
    position: relative;
}

/* Toolbar & Przyciski akcji */
@keyframes panelFloat {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(0, 255, 204, 0.15); }
    50% { box-shadow: 0 0 18px rgba(0, 255, 204, 0.35); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.btn-action {
    background: var(--graphite);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-action:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: var(--shadow-neon);
    transform: translateY(-2px) scale(1.01);
    animation: glowPulse 1.2s ease infinite;
}

/* Pola tekstowe i formularze */
.password-demo-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 680px;
}

.password-demo-note {
    opacity: 0.8;
    line-height: 1.5;
}

.password-demo-output {
    margin-top: 10px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.4s ease both;
}

.password-demo-success {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.password-demo-success, .password-demo-error {
    animation: fadeInUp 0.4s ease both;
}

.password-demo-success h3 {
    color: var(--primary-color);
}

.password-demo-success ol {
    margin-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.password-demo-example {
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.password-demo-error {
    color: #ff7b7b;
    font-weight: 600;
}

.work-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}
.input-group { display: flex; flex-direction: column; flex: 1; }
.input-group label { margin-bottom: 5px; font-weight: bold; color: var(--primary-color); }

.image-section {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.image-section h3 {
    color: var(--primary-color);
}
.image-section p {
    color: var(--text-color);
    line-height: 1.5;
}
.image-toolbar {
    margin-bottom: 0;
}
.image-preview-box {
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
#image-canvas {
    max-width: 100%;
    max-height: 320px;
    width: auto;
    height: auto;
    display: block;
}
.image-status {
    font-size: 0.95rem;
    color: var(--secondary-color);
}

.image-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.image-progress-bar-container {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
    overflow: hidden;
}

.image-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.2s ease;
}

.image-progress-percent {
    min-width: 3rem;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

#image-key-input {
    width: 100%;
}

/* Specjalny wrapper dla pola klucza, by przycisk kopiowania był obok */
.key-input-wrapper {
    display: flex;
    gap: 10px;
}
.key-input-wrapper input {
    flex: 1;
}

textarea, input[type="text"], input[type="password"], select {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    font-size: 1rem;
    resize: none;
    transition: border-color var(--transition-speed);
}
textarea { flex: 1; min-height: 100px; }
textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px var(--primary-color);
}
.drag-over { border: 2px dashed var(--primary-color) !important; background: rgba(0,255,255,0.1) !important; }

/* Pasek Statusu */
#status-bar {
    height: 40px;
    margin: 0 20px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 0.9rem;
    color: var(--primary-color);
}

/* Powiadomienia (Toast) */
#toast-container {
    position: fixed; bottom: 70px; right: 20px;
    display: flex; flex-direction: column; gap: 10px; z-index: 1000;
}
.toast {
    background: var(--graphite); color: #fff;
    padding: 15px 25px; border-radius: 8px;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease-out forwards;
}

/* Ekran Ładowania (Animacje operacji) */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 5000;
}
.loader {
    border: 5px solid rgba(255,255,255,0.1); border-top: 5px solid var(--primary-color);
    border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
.progress-bar-container {
    width: 300px; height: 10px; background: #222; border-radius: 5px; margin: 10px 0; overflow: hidden;
}
.progress-bar { height: 100%; width: 0%; background: var(--primary-color); transition: width 0.1s; }

/* Menu Kontekstowe */
#context-menu {
    position: absolute; z-index: 10000;
    min-width: 150px; padding: 5px 0;
}
#context-menu ul { list-style: none; }
#context-menu li { padding: 10px 20px; cursor: pointer; transition: background 0.2s; }
#context-menu li:hover { background: var(--primary-color); color: #000; }

/* Logi */
.logs-area { flex: 1; overflow-y: auto; background: rgba(0,0,0,0.4); padding: 10px; border-radius: 8px; font-family: monospace; }
.log-entry { margin-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }
.log-time { color: var(--primary-color); margin-right: 10px; }

/* Animacje Keyframes */
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsywność */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        padding-bottom: 20px;
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    #app-container {
        flex-direction: column;
        overflow: auto;
        padding: 12px;
        gap: 12px;
    }

    #sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 12px;
    }

    .sidebar-header {
        width: 100%;
    }

    .menu-list {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .menu-list li {
        margin-bottom: 0;
    }

    .menu-btn {
        width: auto;
        font-size: 0.9rem;
        padding: 8px 10px;
    }

    #main-content {
        width: 100%;
        min-width: 0;
    }

    .panel {
        padding: 14px;
    }

    .toolbar {
        gap: 8px;
    }

    .btn-action, .btn-neon {
        width: 100%;
        justify-content: center;
    }

    .image-toolbar {
        flex-direction: column;
    }

    #status-bar {
        flex-wrap: wrap;
        min-height: auto;
        height: auto;
        padding: 10px;
        gap: 10px;
        justify-content: center;
        margin: 0 12px 12px 12px;
    }

    .key-input-wrapper {
        flex-direction: column;
    }

    textarea, input[type="text"], input[type="password"], select {
        font-size: 16px;
    }

    .splash-content {
        padding: 0 20px;
    }

    .splash-title {
        font-size: 2.7rem;
    }

    .splash-subtitle {
        font-size: 1.1rem;
    }

    .logo-icon {
        font-size: 3.5rem;
    }

    #toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .toolbar {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
    }

    .menu-btn {
        font-size: 0.88rem;
    }

    .panel {
        padding: 12px;
    }

    .splash-title {
        font-size: 2.2rem;
    }
}