* {
    -webkit-tap-highlight-color: transparent;
}
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    height: 100vh;

}

.container {
    text-align: center;
}


#loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--tg-theme-bg-color);
    z-index: 1000;
}

#loader h1 {
    color: var(--tg-theme-text-color);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#loader h2 {
    color: var(--tg-theme-hint-color);
    font-size: 1.1rem;
    position: relative;
    margin-top: 2rem;
}

/* Анимированные точки */
#loader h2::after {
    content: '.';
    animation: dots 1.5s infinite steps(4);
    position: absolute;
    right: -1.2em;
    width: 1em;
}

/* Круговой лоадер */
#loader::before {
    content: '';
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--tg-theme-hint-color);
    border-top-color: var(--tg-theme-button-color);
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

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

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}


/* Стили для модального окна */
.modal_overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1007;
  width:100%;
  height:100%;
}

.modal {
    background: var(--tg-theme-bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 80%;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: modalSlideIn 0.3s ease-out;
}

.modal label {
    color: var(--tg-theme-text-color);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: -8px;
}

.form_input {
    background: var(--tg-theme-secondary-bg-color);
    border: 1px solid var(--tg-theme-hint-color);
    color: var(--tg-theme-text-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form_input:focus {
    outline: none;
    border-color: var(--tg-theme-button-color);
}

.form_input::placeholder {
    color: var(--tg-theme-hint-color);
    opacity: 0.8;
}

.modal .button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    /*cursor: pointer;*/
    transition: opacity 0.2s ease;
    user-select: none;
}

#create_folder_submit {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

#create_folder_close {
    background: transparent;
    color: var(--tg-theme-text-color);
    border: 1px solid var(--tg-theme-hint-color);
}

.button:hover {
    opacity: 0.9;
}

.button:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* Расположение кнопок в ряд */
.modal > .button:last-child {
    margin-top: -0.5rem;
}

.modal > .button + .button {
    margin-top: 0;
}
@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#folders_wrapper{
    display:flex;
    margin:0;
    width:100%;
    height:100%;
    align-items: start;
    justify-content: start;
    flex-direction: column;
    color: var(--tg-theme-text-color);
}
#folders {
    width:90%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.folder, .note {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    /*cursor: pointer;*/
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-align: left;
    min-height: 30px;
    max-height: 30px;
    display: flex;
    padding-top:2.2rem;
    align-items: start;
    justify-content: flex-start;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /*overflow: hidden;*/
    word-break: break-all;
    text-overflow: ellipsis;
}

.create_btn {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    font-weight: 600;
    border: none;
    opacity:90%;
    /*grid-column: span 3;*/
    display:flex;
    padding:1.2rem;
    padding-top:1.4rem;
    padding-bottom:2rem;
    /*position: sticky;*/
    bottom: 1rem;
    border-radius: 12px;
    min-height: 30px;
    max-height: 30px;
    
}

.create_btn::before {
    content: '+';
    display: flex;
    justify-content: center;
    margin: auto;
    min-height: 30px;
    font-size: 2.4rem;
    font-weight: 500;
    transform: translateY(-1px);
    width:100%;
}

/* Общие стили для hover/active */
.folder:hover, .note:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--tg-theme-button-color);
}

.folder:active, .note:active {
    transform: translateY(0);
    opacity: 0.9;
}

.create_btn:hover {
    opacity: 0.95;
    transform: scale(1.02);
}

/* Иконки папок */
.folder:not(#create_folder_open)::before {
    content: '📁';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 1.2em;
    opacity: 0.7;
}
.note:not(#create_folder_open)::before {
    content: '📃';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 1.2em;
    opacity: 0.7;
}

#folder_wrapper{
    display:flex;
    margin:0;
    width:100%;
    height:100%;
    align-items: center;
    justify-content: space-evenly;
    flex-direction: column;
    color: var(--tg-theme-text-color);
}
#folder_notes {
    width:90%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Базовые стили контейнера */
#note_container {
    background: var(--tg-theme-bg-color);
    
    max-width: 100%;
    width:100%;
    margin: 0 auto;
    min-height: 90vh;
    box-sizing: border-box;
}

/* Стили полей ввода */
#note_container .form_input {
    width: 90%;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    border: none;
    border-radius: 12px;

    margin: 8px 0 20px;
    font-size: 16px;
    line-height: 1.4;
    outline: none;
    transition: background 0.2s ease;
}

/* Стили для текстовой области */
#note_container textarea.form_input {
    min-height: 200px;
    resize: none;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

/* Скрытие скроллбара в WebKit */
#note_container textarea.form_input::-webkit-scrollbar {
    display: none;
}

/* Стили плейсхолдера */
#note_container .form_input::placeholder {
    color: var(--tg-theme-hint-color);
    opacity: 0.7;
    font-size: 15px;
}

/* Стили меток */
#note_container label {
    color: var(--tg-theme-text-color);
    font-size: 15px;
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
    padding-left: 8px;
}

/* Стили кнопок */
 .button {
    border: none;
    border-radius: 12px;
    
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: 
        opacity 0.2s ease,
        transform 0.1s ease;
    width: 90%;
    text-align: center;
    margin-top: 12px;
}

 .button.primary {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

 .button.secondary {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
}
 .button.delete {
    background: red;
    color: white;
}

/* Эффекты взаимодействия */
.button:active {
    transform: scale(0.98);
}

#note_container .form_input:focus {
    background: var(--tg-theme-secondary-bg-color);
    box-shadow: 0 0 0 2px var(--tg-theme-link-color);
}

#note_container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--tg-theme-bg-color);
    z-index: 1001;
}

#noteTitle {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--tg-theme-text-color);
}

#noteText {
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 120px);
    margin-bottom: 1rem;
    resize: none;
}

.buttons_container {
    display: flex;
    gap: 0.8rem;
    position: sticky;
    background-color: rgba(0,0,0,0);
    padding: 0.5rem 0;
}
#folder_wrapper .buttons_container {
    bottom: 0;
    width:100%;
    margin-top:115%;
}
#note_container .buttons_container {
    top: 0;
    width:100%;
}

#note_container .button, #folder_wrapper .button{
    flex: 1;
    margin: 0;
    padding: 12px;
    font-size: 0.95rem;
}

/* Анимация авто-высоты */
.auto-resize {
    transition: height 0.2s ease-out;
}

.folder-settings-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 16px;
    box-sizing: border-box;
    gap: 16px;
}

.folder-name-input {
    background-color: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 18px;
    width: 100%;
    box-sizing: border-box;
}

.folder-name-input::placeholder {
    color: var(--tg-theme-hint-color);
}

.users-list {
    flex: 1;
    overflow-y: auto;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-item:last-child {
    border-bottom: none;
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.user-id {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.user-name {
    font-size: 16px;
    color: var(--tg-theme-text-color);
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.remove-user-button {
    background: none;
    border: none;
    color: #e53935;
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.remove-user-button:hover {
    background-color: rgba(229, 57, 53, 0.1);
}

.folder-settings-container.buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.folder_settings_button {
    flex: 1;
    min-width: calc(50% - 4px);
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
}

.folder_settings_button:active {
    opacity: 0.7;
}

.delete-button {
    background-color: #e53935;
    color: white;
}

.cancel-button {
    background-color: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
}

.save-button {
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.share-button {
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    
}