/* Eleganckie style dla formularzy uwierzytelniania */

/* Zmienne kolorów dla formularzy auth */
:root {
    --auth-primary: #1877f2;
    --auth-primary-hover: #166fe5;
    --auth-secondary: #42b72a;
    --auth-secondary-hover: #36a420;
    --auth-danger: #dc3545;
    --auth-text: #1c1e21;
    --auth-text-muted: #65676b;
    --auth-white: #ffffff;
}

[data-theme="dark"] {
    --auth-primary: #4e9af1;
    --auth-primary-hover: #3b82d6;
    --auth-text: #e4e6ea;
    --auth-text-muted: #b0b3b8;
    --auth-white: #242526;
}

/* Tło dla stron autoryzacji */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.05"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.6;
}

[data-theme="dark"] .auth-page {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* Główny kontener */
.auth-container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 20px 0;
}

/* Karta formularza */
.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: slideUp 0.6s ease-out;
}

[data-theme="dark"] .auth-card {
    background: rgba(36, 37, 38, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header karty */
.auth-card .card-header {
    background: transparent;
    border: none;
    text-align: center;
    padding: 30px 30px 20px;
    position: relative;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-brand .brand-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-right: 15px;
    box-shadow: 0 8px 16px rgba(24, 119, 242, 0.3);
}

.auth-brand .brand-text {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--auth-text);
    margin: 0;
}

.auth-subtitle {
    color: var(--auth-text-muted);
    font-size: 16px;
    margin-top: 8px;
}

/* Body karty */
.auth-card .card-body {
    padding: 0 30px 20px;
    background: transparent;
}

/* Grupy formularza */
.auth-form-group {
    margin-bottom: 25px;
    position: relative;
}

.auth-form-group:last-child {
    margin-bottom: 30px;
}

/* Etykiety */
.auth-label {
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 8px;
    font-size: 14px;
    display: block;
    transition: color 0.3s ease;
}

/* Pola wejściowe */
.auth-input {
    width: 100% !important;
    padding: 15px 20px !important;
    border: 2px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--auth-text) !important;
    transition: all 0.3s ease;
    position: relative;
    min-height: 50px !important;
    max-height: none !important;
    height: auto !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Gdy pole ma ikonę, dodajemy padding-left */
.auth-input-wrapper .auth-input {
    padding-left: 50px !important;
}

[data-theme="dark"] .auth-input {
    background: rgba(58, 59, 60, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.1);
    transform: translateY(-2px);
}

[data-theme="dark"] .auth-input:focus {
    background: rgba(58, 59, 60, 1);
    box-shadow: 0 0 0 4px rgba(78, 154, 241, 0.2);
}

.auth-input::placeholder {
    color: var(--auth-text-muted);
    font-size: 14px;
}

/* Ikony w polach */
.auth-input-wrapper {
    position: relative !important;
    min-height: 50px !important;
    height: auto !important;
    display: block !important;
    width: 100% !important;
}

.auth-input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-text-muted);
    font-size: 18px;
    z-index: 3;
    transition: color 0.3s ease;
    pointer-events: none;
}

.auth-input:focus + .auth-input-icon {
    color: var(--auth-primary);
}

/* Debug info: usunięta problematyczna reguła fallback */

/* Checkbox "Zapamiętaj mnie" */
.auth-checkbox {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.auth-checkbox input[type="checkbox"] {
    display: none;
}

.auth-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

[data-theme="dark"] .auth-checkbox-custom {
    border-color: rgba(255, 255, 255, 0.3);
}

.auth-checkbox-custom::after {
    content: '✓';
    font-size: 14px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.auth-checkbox input[type="checkbox"]:checked + .auth-checkbox-custom {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.auth-checkbox input[type="checkbox"]:checked + .auth-checkbox-custom::after {
    opacity: 1;
    transform: scale(1);
}

.auth-checkbox-label {
    color: var(--auth-text);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

/* Przyciski */
.auth-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
    color: white;
    box-shadow: 0 8px 16px rgba(24, 119, 242, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(24, 119, 242, 0.4);
}

.auth-btn-secondary {
    background: linear-gradient(135deg, var(--auth-secondary), var(--auth-secondary-hover));
    color: white;
    box-shadow: 0 8px 16px rgba(66, 183, 42, 0.3);
}

.auth-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(66, 183, 42, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

/* Efekt loading */
.auth-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s ease infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Linki */
.auth-links {
    text-align: center;
    margin: 20px 0;
}

.auth-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.auth-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background-color: var(--auth-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.auth-link:hover {
    text-decoration: none;
    color: var(--auth-primary-hover);
}

.auth-link:hover::after {
    width: 100%;
}

/* Footer karty */
.auth-card .card-footer {
    background: rgba(0, 0, 0, 0.02);
    border: none;
    text-align: center;
    padding: 25px 30px;
    color: var(--auth-text-muted);
    font-size: 14px;
}

[data-theme="dark"] .auth-card .card-footer {
    background: rgba(255, 255, 255, 0.02);
}

/* Alerty */
.auth-alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: none;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

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

.auth-alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-left: 4px solid #dc3545;
}

.auth-alert-success {
    background: rgba(66, 183, 42, 0.1);
    color: #42b72a;
    border-left: 4px solid #42b72a;
}

/* Divider */
.auth-divider {
    position: relative;
    text-align: center;
    margin: 25px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .auth-divider::before {
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 15px;
    color: var(--auth-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .auth-divider span {
    background: rgba(36, 37, 38, 0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .auth-container {
        padding: 15px;
    }
    
    .auth-card {
        margin: 0;
        border-radius: 16px;
    }
    
    .auth-card .card-header,
    .auth-card .card-body,
    .auth-card .card-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .auth-brand .brand-text {
        font-size: 24px;
    }
    
    .auth-title {
        font-size: 20px;
    }
    
    .auth-input {
        font-size: 16px; /* Zapobiega zoom na iOS */
    }
}

/* Dodatkowe animacje - opcjonalne, usunięte początkowe opacity: 0 */
.auth-form-group {
    opacity: 1; /* Zawsze widoczne */
    transform: translateY(0); /* Bez przesunięcia */
}

/* Opcjonalne animacje - można włączyć dodając klasę .animated-form */
.animated-form .auth-form-group {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.animated-form .auth-form-group:nth-child(1) { animation-delay: 0.1s; }
.animated-form .auth-form-group:nth-child(2) { animation-delay: 0.2s; }
.animated-form .auth-form-group:nth-child(3) { animation-delay: 0.3s; }
.animated-form .auth-form-group:nth-child(4) { animation-delay: 0.4s; }
.animated-form .auth-form-group:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cząstki w tle */
.auth-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.auth-particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.auth-particle:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.auth-particle:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 60%;
    right: 20%;
    animation-delay: 2s;
}

.auth-particle:nth-child(3) {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 10%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.3;
    }
}
