/* HELPio Custom Styles */
:root {
    --primary-green: #10b981;
    --primary-red: #ef4444;
    --bg-dark: #1f2937;
    --bg-light: #f3f4f6;
    --tile-bg: #ab7a74;
    --purple-banner: #8b5cf6;
    --text-light: #ffffff;
    --text-dark: #111827;
    --radius: 0.75rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.app-header {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.logo-link {
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo-image {
    height: 40px;
    width: auto;
}

.apps-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.apps-label {
    font-size: 0.9rem;
    display: none;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-icon {
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.3s;
    position: relative;
}

.header-icon:hover {
    color: var(--primary-green);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary-red);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Show label on larger screens */
@media (min-width: 768px) {
    .apps-label {
        display: inline;
    }
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-dark);
    color: var(--text-light);
    transition: left 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2rem 0;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    flex-grow: 1;
}

/* Updated for <a> tags instead of <li> */
.sidebar-nav-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.3s;
    text-decoration: none;
    /* Remove underline for links */
    color: var(--text-light);
}

.sidebar-nav-item:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

.sidebar-nav-item.active {
    background-color: rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--primary-green);
}

.sidebar-nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-logo {
    padding: 2rem 1.5rem 1rem;
    margin-top: auto;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
    max-width: 100%;
    height: auto;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.sidebar-logo img:hover {
    opacity: 1;
}

/* Apps Panel (Right Sidebar) */
.apps-panel {
    position: fixed;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100vh;
    background-color: var(--bg-dark);
    color: var(--text-light);
    transition: right 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
}

.apps-panel.open {
    right: 0;
}

.apps-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apps-panel-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
}

.apps-panel-header i {
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.apps-panel-header i:hover {
    color: var(--primary-red);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.app-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    /* Ensure <a> acts as block */
    text-decoration: none;
    color: var(--text-light);
}

.app-item:hover {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--primary-green);
    transform: scale(1.05);
}

.app-item i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: #FFD54F;
    display: block;
    /* center the icon */
    margin-left: auto;
    margin-right: auto;
}

.app-item span {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
}

.apps-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
}

.apps-overlay.active {
    display: block;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1rem;
    padding-bottom: 6.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Banner/Carousel */
.banner-section {
    background: linear-gradient(135deg, var(--purple-banner), #a78bfa);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.banner-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.banner-button {
    background-color: white;
    color: var(--purple-banner);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
}

.banner-button:hover {
    transform: scale(1.05);
}

.banner-dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.banner-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
}

.banner-dot.active {
    background-color: white;
}

/* Tiles Grid */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 5rem;
}

.tile {
    background-color: var(--tile-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: block;
    /* Ensure <a> acts as block */
    text-decoration: none;
    color: white;
}

.tile:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tile-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.tile-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tile-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.75rem;
    transition: color 0.3s;
    flex: 1;
    text-align: center;
    text-decoration: none;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--primary-green);
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.emergency-button {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-red), #dc2626);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-top: -28px;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
    cursor: pointer;
    transition: transform 0.3s;
}

.emergency-button:hover {
    transform: scale(1.1);
}

/* Responsive Design */
@media (min-width: 600px) {
    .tiles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .tiles-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .bottom-nav {
        display: none;
    }
}

/* Utility Classes */
.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Dashboard Specific Styles (merged) */
.banner-section {
    transition: background 0.6s ease;
}

.banner-title {
    transition: opacity 0.3s ease;
}

.banner-dot {
    cursor: pointer;
    transition: all 0.3s ease;
}

.banner-dot:hover {
    transform: scale(1.2);
}

/* Lena AI Overlay */
#lena-ai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white;
    z-index: 9999;
    /* Highest priority */
    transform: translateY(-100%);
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
}

#lena-ai-overlay.open {
    transform: translateY(0);
}

#lena-ai-overlay iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
}

.lena-close-btn {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-red);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 10000;
}

.lena-close-btn:hover {
    transform: translateX(-50%) scale(1.1);
    background-color: #dc2626;
}

.lena-close-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* Apps Panel Header */
.apps-panel-header {
    display: flex;
    flex-direction: column;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Apps Panel Button */
.btn-browse-apps {
    font-size: 0.75rem;
    /* Mniejszy tekst */
    color: #10b981;
    text-decoration: none;
    border: 1px solid #10b981;
    padding: 0.3rem 1rem;
    border-radius: 1rem;
    align-self: flex-start;
    /* Do lewej */
    transition: all 0.2s;
    background: transparent;
    display: inline-block;
    text-align: center;
}

.btn-browse-apps:hover {
    background: #10b981;
    color: white;
}

/* --- App Management Styles --- */

/* Edit Mode Toggle */
.apps-edit-toggle {
    cursor: pointer;
    font-size: 0.9rem;
    color: #9ca3af;
    transition: color 0.3s;
    margin-left: 0.5rem;
}

.apps-edit-toggle:hover,
.apps-edit-toggle.active {
    color: var(--primary-green);
}

/* Delete Button (Badge) */
.app-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background-color: var(--primary-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.app-delete-btn:hover {
    transform: scale(1.1);
}

/* Edit Mode Active State */
.apps-grid.edit-mode .app-item {
    animation: shake 2s infinite ease-in-out;
    border-style: dashed;
}

.apps-grid.edit-mode .app-delete-btn {
    opacity: 1;
    pointer-events: auto;
}

.app-item {
    position: relative;
    /* For positioning delete badge */
}

@keyframes shake {
    0% {
        transform: rotate(0deg);
    }

    2% {
        transform: rotate(-1deg);
    }

    4% {
        transform: rotate(1deg);
    }

    6% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

/* Drag & Drop */
.app-item.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary-green);
}

.app-item.drag-over {
    border: 2px solid var(--primary-green);
    transform: scale(1.02);
}

/* Custom Modal */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.custom-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.custom-modal {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 320px;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.custom-modal-overlay.active .custom-modal {
    transform: translateY(0);
}

.custom-modal h3 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.custom-modal p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-modal {
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-modal:hover {
    opacity: 0.9;
}

.btn-cancel {
    background: #e5e7eb;
    color: var(--text-dark);
}

.btn-confirm {
    background: var(--primary-red);
    color: white;
}

.banner-support-label {
    max-width: 1200px;
    margin: 0 auto 0.5rem auto;
    padding: 0 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: black;
}
