body { 
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #1e1e1e;
    color: #ffffff;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body.light-mode {
    background-color: #f5f5f5;
    color: #333333;
}

body.light-mode #container {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
}

body.light-mode .CodeMirror {
    border: 1px solid #e0e0e0;
}

body.light-mode #codeList li {
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    color: #333;
}

body.light-mode #codeList li:hover {
    background: #e8e8e8;
}

#container { 
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    margin-top: 60px; /* Add space for fixed header */
}

.CodeMirror { 
    height: 500px !important;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    transition: border 0.3s ease;
}

button { 
    margin: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #0078d4;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

button:hover { 
    background-color: #2b95ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(0);
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.7);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.7;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

button:active::after {
    animation: ripple 0.6s ease-out;
}

#codeList {
    list-style-type: none;
    padding: 0;
    position: relative;
    min-height: 100px;
}

#codeList .loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 30, 30, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    border-radius: 8px;
}

#codeList.loading .loading-overlay {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-left-color: #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#codeList li { 
    margin: 8px 0;
    padding: 15px;
    background: #252526;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#codeList li:hover {
    background: #2d2d2d;
}

#codeList li.removing {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

#codeList li div {
    display: flex;
    gap: 5px;
}

#codeList li button {
    padding: 8px 12px;
    margin: 0 2px;
    font-size: 12px;
}

#codeList li button.edit-btn {
    background-color: #ff9800;
}

#codeList li button.delete-btn {
    background-color: #d32f2f;
}

#codeList li button.copy-btn {
    background-color: #9c27b0;
}

#codeList li button.download-btn {
    background-color: #1976d2;
}

#codeList li button.compile-btn {
    background-color: #2e7d32;
}

h1, h2 {
    color: #ffffff;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

body.light-mode h1, 
body.light-mode h2 {
    color: #333333;
}

.user-select {
    display: flex;
    gap: 10px;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 20px;
    background: #252526;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

body.light-mode .user-select {
    background: #f0f0f0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.user-select select {
    padding: 5px 10px;
    background: #1e1e1e;
    color: white;
    border: 1px solid #0078d4;
    border-radius: 3px;
}

body.light-mode .user-select select {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}

.logout-btn {
    background-color: #d32f2f;
    padding: 5px 10px;
    font-size: 12px;
    margin-left: auto;
}

.editing-mode .save-changes {
    display: inline-block !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(56, 142, 60, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(56, 142, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 142, 60, 0); }
}

.editing-mode #saveBtn {
    display: none;
}

.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #333;
    color: white;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateX(30px);
    animation: notificationIn 0.3s forwards;
}

body.light-mode .notification {
    background: #f0f0f0;
    color: #333;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

@keyframes notificationIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.hiding {
    animation: notificationOut 0.3s forwards;
}

@keyframes notificationOut {
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

.chat-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1976d2;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-button:hover {
    transform: scale(1.1);
    background: #1565c0;
}

.chat-button svg {
    transition: transform 0.3s ease;
}

.chat-button.active {
    background: #0d47a1;
}

.chat-button.active svg {
    transform: scale(0.8);
}

.chat-container {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 300px;
    height: 400px;
    background: #252526;
    border: 1px solid #333;
    border-radius: 8px;
    display: none;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

body.light-mode .chat-container {
    background: #fff;
    border-color: #ddd;
}

.chat-container.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chat-header {
    padding: 10px 15px;
    background: #1e1e1e;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

body.light-mode .chat-header {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.chat-input button {
    padding: 8px 16px;
    background: #0078d4;
    transition: all 0.2s ease;
}

.chat-input button:hover {
    background: #2b95ff;
    transform: translateY(-1px);
}

.message {
    margin: 5px 0;
    padding: 8px 12px;
    background: #252526;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    transition: opacity 0.5s ease-out;
    animation: messageSlideIn 0.2s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
    position: relative;
}

.message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
}

.message:hover::after {
    transform: scaleX(1);
}

body.light-mode .message::after {
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.1), transparent);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-time {
    color: #666;
    font-size: 0.8em;
    white-space: nowrap;
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-box {
    background: #252526;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    animation: authBoxAppear 0.4s ease-out forwards;
    transform: translateY(-20px);
    opacity: 0;
}

@keyframes authBoxAppear {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-box input {
    margin: 10px 0;
    padding: 8px;
    width: 200px;
    background: #1e1e1e;
    border: 1px solid #333;
    color: white;
    border-radius: 4px;
}

.auth-box select {
    margin: 10px 0;
    padding: 8px;
    width: 200px;
    background: #1e1e1e;
    border: 1px solid #333;
    color: white;
    border-radius: 4px;
}

.auth-box input[type="password"] {
    padding-right: 40px;
    position: relative;
}

.password-container {
    position: relative;
    width: 100%;
    margin: 10px 0;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0;
    margin: 0;
    width: 24px;
    height: 24px;
}

.toggle-password:focus {
    outline: none;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #666;
    stroke-width: 2px;
}

body.light-mode .toggle-password svg {
    stroke: #333;
}

#password-step, #user-step {
    text-align: center;
}

#user-step select {
    display: block;
    margin: 20px auto;
}

.author {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #666;
    font-size: 14px;
    z-index: 997;
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
}

.author:hover {
    opacity: 1;
    transform: translateY(-3px);
}

.save-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.save-modal {
    background: #252526;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    animation: modalAppear 0.3s ease-out forwards;
    transform: scale(0.95);
    opacity: 0;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

@keyframes modalAppear {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.save-modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #fff;
}

.save-modal input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    background: #1e1e1e;
    border: 1px solid #333;
    color: white;
    border-radius: 4px;
    font-size: 14px;
}

.save-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.save-modal-buttons button.cancel {
    background-color: #d32f2f;
}

/* Stylizacja scrollbarów */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #3e3e3e;
    border-radius: 5px;
    border: 2px solid #1e1e1e;
}

::-webkit-scrollbar-thumb:hover {
    background: #4e4e4e;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #3e3e3e #1e1e1e;
}

.chat-messages, 
select,
.CodeMirror-vscrollbar,
.CodeMirror-hscrollbar {
    scrollbar-width: thin;
    scrollbar-color: #3e3e3e #1e1e1e;
}

/* Style dla użytkowników */
.user-woocaash {
    color: #2196F3;
    font-weight: 500;
}

.user-hikaru {
    color: #f44336;
    font-weight: 500;
}

.user-konach {
    color: #4CAF50;
    font-weight: 500;
}

.user-skibidigostek {
    color: #ff9800;
    font-weight: 500;
}

.system-message {
    color: #ff9800;
    font-style: italic;
    font-weight: 500;
}

/* Style dla przycisków edytora */
.editor-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    align-items: center;
}

.editor-buttons button.save-changes {
    background-color: #388e3c;
    display: none;
}

/* Dodatkowe style dla selecta języka */
#languageSelect {
    padding: 5px 10px;
    background: #252526;
    color: white;
    border: 1px solid #666;
    border-radius: 4px;
    position: relative;
    padding: 8px 30px 8px 15px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ddd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.3s;
}

#languageSelect:hover {
    border-color: #0078d4;
}

/* Dodaj style dla przycisku kompilacji */
#compileBtn, 
button.compile-btn {
    background-color: #2e7d32;
    color: white;
    margin-left: auto; /* Przesuwa przycisk na prawą stronę */
}

#compileBtn:hover,
button.compile-btn:hover {
    background-color: #388e3c;
}

/* Wskaźniki stanu dla przycisków */
button.success {
    background-color: #4CAF50;
    animation: successPulse 1s;
}

@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* Animacja dla daty grupowania */
#codeList li.date-header {
    background-color: transparent !important;
    border-bottom: 1px solid #444;
    transform: translateX(0);
    transition: all 0.3s ease;
    margin-top: 20px;
    padding: 10px;
    font-size: 14px;
    color: #888;
}

#codeList li.date-header:hover {
    color: #fff;
    border-bottom-color: #0078d4;
    padding-left: 15px;
}

/* Efekt przewijania dla długich nazw kodów */
#codeList li .code-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    transition: all 0.5s;
}

#codeList li:hover .code-title {
    overflow: visible;
    max-width: none;
    animation: scrollTitle 8s linear infinite;
    padding-right: 20px;
}

@keyframes scrollTitle {
    0%, 10% { transform: translateX(0); }
    90%, 100% { transform: translateX(calc(-100% + 200px)); }
}

/* Wsparcie dla ekranów dotykowych */
@media (hover: none) {
    button:hover {
        transform: none;
        box-shadow: none;
    }
    
    .author:hover {
        transform: none;
    }
}

/* Przełącznik trybu jasnego/ciemnego */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    transition: transform 0.3s ease, background-color 0.2s ease;
    overflow: visible !important;
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    stroke: #ffffff;
    transition: transform 0.5s ease;
}

body.light-mode .theme-toggle svg {
    stroke: #333333;
}

.theme-toggle:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-2px) scale(1.1);
}

body.light-mode .theme-toggle:hover {
    background-color: rgba(0,0,0,0.1);
}

.theme-toggle:active svg {
    transform: rotate(180deg);
}

.animate-toggle svg {
    animation: toggle-rotation 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes toggle-rotation {
    0% { transform: rotate(0); }
    100% { transform: rotate(360deg); }
}

/* Dodatkowe style dla animacji cząsteczek i efektów */
.particle {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    animation: particle-fade 1s forwards;
    box-shadow: 0 0 10px currentColor;
}

@keyframes particle-fade {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Animacja efektu pisania */
.typewriter {
    white-space: nowrap;
    overflow: hidden;
    border-right: 3px solid #0078d4;
    animation: typing 3.5s steps(30, end), blinking 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blinking {
    from, to { border-color: transparent }
    50% { border-color: #0078d4 }
}

/* Dodatkowe style dla formularza logowania */
.auth-box button {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    transform: translateY(0);
}

.auth-box button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Stylizacja zwijanych sekcji dat */
#codeList li.date-header {
    cursor: pointer;
    position: relative;
}

#codeList li.date-header::after {
    content: '▼';
    position: absolute;
    right: 10px;
    transition: transform 0.3s ease;
}

#codeList li.date-header.expanded::after {
    transform: rotate(180deg);
}

#codeList li.code-item {
    transform-origin: top;
    transition: all 0.3s ease;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

/* Ulepszony wskaźnik ładowania */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 120, 212, 0.2);
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite, pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: rotate(0deg) scale(1); box-shadow: 0 0 0 rgba(0, 120, 212, 0); }
    to { transform: rotate(360deg) scale(1.1); box-shadow: 0 0 10px rgba(0, 120, 212, 0.5); }
}

/* Style dla animacji pasków postępu */
.progress-bar {
    height: 3px;
    background: linear-gradient(to right, #2196F3, #4CAF50, #FF9800);
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    z-index: 1001;
    transition: width 0.3s ease;
    animation: gradient-shift 3s linear infinite;
    box-shadow: 0 0 10px rgba(0, 120, 212, 0.5);
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Style dla spinnera zapisywania */
.saving-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s infinite linear;
    margin-right: 8px;
    vertical-align: middle;
}

/* Ulepszone fokusowanie dla pól wejściowych */
input:focus, select:focus {
    outline: none;
    animation: focus-pulse 1s infinite alternate;
}

@keyframes focus-pulse {
    0% { box-shadow: 0 0 0 1px rgba(0, 120, 212, 0.3); }
    100% { box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.3); }
}
