/* Custom Styles for Tegelbruket Youth App */

/* Page Transitions */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    background: white;
}

.page.active {
    transform: translateX(0);
}

.page.slide-out-left {
    transform: translateX(-100%);
}

.page.slide-out-right {
    transform: translateX(100%);
}

/* Content Section Transitions */
.content-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.content-section.active {
    transform: translateX(0);
}

.content-section.slide-out-left {
    transform: translateX(-100%);
}

.content-section.slide-out-right {
    transform: translateX(100%);
}

/* Navigation Styles */
.nav-item {
    color: #6b7280;
    transition: color 0.2s ease;
    border: none;
    background: none;
    outline: none;
}

.nav-item.active {
    color: #50737d;
}

.nav-item:hover {
    color: #50737d;
}

/* Profile Dropdown Animation */
#profile-dropdown {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

#profile-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Touch Friendly Buttons */
button, .nav-item {
    min-height: 44px;
    min-width: 44px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Input Focus States */
input:focus, textarea:focus {
    box-shadow: 0 0 0 2px rgba(80, 115, 125, 0.1);
}

/* Loading Animation */
.loading {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Card Hover Effects */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #50737d;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* PWA Specific Styles */
@media (display-mode: standalone) {
    body {
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Hide address bar on iOS */
    .ios-safari-fix {
        height: calc(100vh - env(safe-area-inset-bottom));
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        background-color: #1f2937;
        color: #f9fafb;
    }
}

/* Responsive Adjustments */
@media (max-width: 320px) {
    .nav-item {
        font-size: 0.7rem;
    }
    
    .nav-item i {
        font-size: 0.9rem;
    }
}

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Message Bubble Styles */
.message-bubble {
    max-width: 70%;
    word-wrap: break-word;
}

.message-bubble.sent {
    background-color: #50737d;
    color: white;
    margin-left: auto;
}

.message-bubble.received {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* Status Indicators */
.status-online {
    background-color: #10b981;
}

.status-away {
    background-color: #f59e0b;
}

.status-offline {
    background-color: #6b7280;
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Visible for Keyboard Navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #50737d;
    outline-offset: 2px;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Pull to Refresh Styling */
.ptr-element {
    pointer-events: none;
    font-size: 0.85em;
    font-weight: bold;
    top: 15px;
    height: 0;
    transition: height 0.3s, min-height 0.3s;
    text-align: center;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    align-content: stretch;
}

.ptr-element div {
    padding: 10px;
    border-radius: 3px;
    width: 100%;
}