/* Общие стили для всех страниц Nextcloud */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Nunito', 'Roboto', system-ui, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

body.light {
    background: #f5f5f5;
    color: #333;
}

body.dark {
    background: #1a1e24;
    color: #e0e0e0;
}

/* Контейнер для форм */
.login-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
}

/* Переключатель темы */
.theme-switch {
    position: absolute;
    top: -60px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.05);
    padding: 5px 12px;
    border-radius: 40px;
    backdrop-filter: blur(4px);
}

body.dark .theme-switch {
    background: rgba(255,255,255,0.1);
}

.theme-toggle {
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.theme-toggle::after {
    content: '';
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

body.dark .theme-toggle {
    background: #0082c9;
}

body.dark .theme-toggle::after {
    transform: translateX(20px);
}

/* Логотип */
.logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo img {
    width: 80px;
    height: auto;
}

body.dark .logo img {
    filter: brightness(0.9);
}

/* Карточка */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    padding: 32px 28px;
    transition: background 0.3s;
}

body.dark .card {
    background: #2c2f36;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Сообщения */
.error-message, .success-message {
    display: none;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.error-message {
    background: #ffebee;
    color: #c0392b;
    border-left: 3px solid #e74c3c;
}

body.dark .error-message {
    background: #3b2a2a;
    color: #ff9e8f;
    border-left-color: #ff6b5b;
}

.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #2e7d32;
}

body.dark .success-message {
    background: #2c3a2c;
    color: #8bc34a;
    border-left-color: #8bc34a;
}

/* Лоадер */
.loader {
    display: none;
    text-align: center;
    margin-bottom: 20px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #0082c9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 8px auto;
}

body.dark .spinner {
    border-color: #555;
    border-top-color: #0082c9;
}

.loader span {
    font-size: 12px;
    color: #666;
}

body.dark .loader span {
    color: #aaa;
}

/* Формы */
.form-group {
    margin-bottom: 18px;
    position: relative;
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon i {
    position: absolute;
    left: 12px;
    font-size: 18px;
    color: #aaa;
    font-style: normal;
}

.input-icon input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

body.dark .input-icon input {
    background: #3a3f48;
    border-color: #555;
    color: #eee;
}

.input-icon input:focus {
    border-color: #0082c9;
    box-shadow: 0 0 0 3px rgba(0,130,201,0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    color: #888;
    user-select: none;
}

body.dark .toggle-password {
    color: #aaa;
}

/* Индикатор сложности пароля */
.password-strength {
    margin-top: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.strength-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 4px;
    flex: 1;
    overflow: hidden;
}

body.dark .strength-bar {
    background: #555;
}

.strength-fill {
    width: 0%;
    height: 100%;
    transition: width 0.2s, background 0.2s;
}

.weak .strength-fill {
    background: #e74c3c;
    width: 33%;
}

.medium .strength-fill {
    background: #f39c12;
    width: 66%;
}

.strong .strength-fill {
    background: #27ae60;
    width: 100%;
}

.strength-text {
    font-size: 11px;
    min-width: 70px;
}

.validation-hint {
    font-size: 11px;
    margin-top: 4px;
    color: #888;
}

body.dark .validation-hint {
    color: #aaa;
}

.validation-error {
    color: #e74c3c;
}

.validation-ok {
    color: #27ae60;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    font-size: 13px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label a {
    color: #0082c9;
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* Кнопки */
.login-button {
    width: 100%;
    background: #0082c9;
    border: none;
    border-radius: 44px;
    padding: 12px;
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    margin-bottom: 24px;
}

.login-button:hover {
    background: #006ea8;
}

.login-button:disabled {
    background: #b0d4f0;
    cursor: not-allowed;
}

/* Ссылки */
.links {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.links a {
    color: #0082c9;
    text-decoration: none;
    font-weight: 500;
}

.links a:hover {
    text-decoration: underline;
}

/* Футер */
.footer {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    color: #777;
}

body.dark .footer {
    color: #aaa;
}

/* Cookie consent */
.cookie-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.cookie-consent {
    max-width: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 35px rgba(0,0,0,0.2);
    padding: 20px 24px;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

body.dark .cookie-consent {
    background: #2c2f36;
    color: #e0e0e0;
    box-shadow: 0 20px 35px rgba(0,0,0,0.5);
}

.cookie-consent p {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.cookie-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.cookie-btn {
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.cookie-btn-primary {
    background: #0082c9;
    color: white;
}

.cookie-btn-primary:hover {
    background: #006ea8;
}

.cookie-btn-secondary {
    background: transparent;
    border: 1px solid #0082c9;
    color: #0082c9;
}

body.dark .cookie-btn-secondary {
    border-color: #5bb4e0;
    color: #5bb4e0;
}

.cookie-btn-secondary:hover {
    background: rgba(0,130,201,0.1);
}

/* Анимации */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

.shake-effect {
    animation: shake 0.3s ease-in-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
    .card {
        padding: 24px 20px;
    }
    .logo img {
        width: 70px;
    }
    .cookie-consent {
        padding: 16px 20px;
    }
}