/* 
 * REACHWAYS STYLING FOR DaaS CLIENT PORTAL 
 * Theme: "Absolute Clean" (Vercel / Linear inspired, White & Silver)
 */

:root {
    /* Backgrounds */
    --bg-main: #f4f5f7;
    /* Very light silver/gray for depth */
    --bg-surface: #ffffff;
    /* Pure white for cards */
    --bg-surface-hover: #f9fafb;
    --bg-sidebar: #ffffff;

    /* Borders & Contrast */
    --border-light: rgba(0, 0, 0, 0.06);
    --border-focus: #000000;

    /* Text */
    --text-main: #09090b;
    /* Deep almost-black for crisp reading */
    --text-muted: #71717a;
    --text-inverse: #ffffff;

    /* Brand Colors */
    --primary: #000000;
    /* Apple-like absolute black buttons */
    --primary-hover: #27272a;
    --accent-blue: #0066cc;
    /* Sharp iOS blue */
    --accent-blue-bg: #f0f7ff;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Refined Shadows for depth */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
    --shadow-floating: 0 20px 40px -10px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);
    /* For Modals & Sidebar */

    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* --- Login Screen --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--bg-surface);
    width: 100%;
    max-width: 400px;
    padding: 3rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.input-group-custom input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
    background: var(--bg-main);
}

.input-group-custom input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
    background: var(--bg-surface);
}

.btn-primary-clean {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-clean:hover {
    background: var(--primary-hover);
    color: white !important;
    /* Forces the text to remain white to prevent invisible text on hover */
    transform: translateY(-1px);
}

/* --- App Dashboard Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-main);
    padding: 1rem;
    /* Breathes around the elements */
    gap: 1.5rem;
}

/* Sidebar - Floating Island */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: var(--shadow-floating);
    height: calc(100vh - 2rem);
    position: sticky;
    top: 1rem;
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 2rem;
    margin-top: 0.5rem;
    padding: 0 0.5rem;
    display: flex;
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    /* Center vertically */
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    min-height: 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    /* overflow: hidden; removed to allow ::before to overhang outside */
}

.nav-item::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    height: 55%;
    width: 4px;
    background: var(--primary);
    border-radius: 4px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item i {
    font-size: 1.15rem;
    transition: transform 0.25s ease;
}

.nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    background: var(--bg-main);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

.sidebar-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 1.5rem;
}

.client-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    flex-shrink: 0;
    overflow: hidden;
}

.client-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.client-info .plan {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 99px;
    display: inline-block;
    margin-top: 2px;
}

.badge-pro {
    background: var(--accent-blue-bg);
    color: var(--accent-blue);
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.logout-link:hover {
    color: #ef4444;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    /* Allow regular page flow */
    /* Removed position: relative and z-index: 1 to fix Bootstrap Modal backdrop issue */
}

.top-header {
    padding: 2.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.95);
    /* More opaque */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: sticky;
    top: 0;
    z-index: 40;
    /* Higher than columns */
}


.page-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* --- Kanban Board --- */
.board-container {
    display: flex;
    padding: 1.5rem 2rem 2.5rem 2rem;
    /* Reduced padding slightly to give columns more room */
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    /* Allows columns to drop down on small screens instead of scrolling sideways */
    flex: 1;
    min-height: 0;
}

.board-container::-webkit-scrollbar {
    height: 8px;
}

.board-container::-webkit-scrollbar-track {
    background: transparent;
}

.board-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.board-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.board-column {
    flex: 1;
    min-width: 300px;
    /* Gives cards healthy width, drops down if screen is too small */
    flex-shrink: 0;
    background: transparent;
    border-radius: var(--radius-lg);
    border: none;
    display: flex;
    flex-direction: column;
}

.column-header {
    padding: 1rem 1.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.04);
    background: var(--bg-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: sticky;
    top: 99px;
    /* This specifically matches the exact height + padding of .top-header to create a perfect cascading sticky effect */
    z-index: 20;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -5px rgba(0, 0, 0, 0.05);
}

.column-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.column-title span {
    font-weight: 400;
    opacity: 0.7;
    margin-left: auto;
}

.column-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    background: rgba(0, 0, 0, 0.015);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Custom minimal scrollbar for Kanban lists */
.column-body::-webkit-scrollbar {
    width: 6px;
}

.column-body::-webkit-scrollbar-track {
    background: transparent;
}

.column-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.column-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Task Cards - Premium Lift */
.task-card {
    background: var(--bg-surface);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    /* CRUCIAL: Prevents the card from being squished vertically by the flex container */
    display: flex;
    flex-direction: column;
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.02) inset;
    pointer-events: none;
}

.task-card:hover {
    box-shadow: var(--shadow-floating);
    transform: translateY(-4px) scale(1.01);
    border-color: rgba(0, 0, 0, 0.08);
}

.task-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.badge-queue {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-active {
    background: #eff6ff;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-done {
    background: #ecfdf5;
    color: #059669;
}

.task-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.task-excerpt {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;

    /* Modern text truncation to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-light);
    padding-top: 0.75rem;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed var(--border-light);
    padding-top: 0.75rem;
}

.avatar-sm {
    width: 24px;
    height: 24px;
    background: #e5e7eb;
    color: #4b5563;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.view-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.view-link:hover {
    text-decoration: underline;
}

/* Active Card Specials */
.active-task {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.1);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: #3b82f6;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.done-task {
    opacity: 0.7;
}

.done-task:hover {
    opacity: 1;
}

/* --- Modals and Forms --- */
.custom-modal .modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--bg-surface);
}

.clean-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.clean-input {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    background: var(--bg-main);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.clean-input:focus {
    background: var(--bg-surface);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    outline: none;
}

.file-upload-clean {
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    background: var(--bg-main);
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-clean:hover {
    background: var(--bg-surface);
    border-color: var(--primary);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 991px) {

    /* Layout */
    .app-layout {
        flex-direction: column;
        padding: 0;
        gap: 0;
        min-height: auto;
    }

    /* Sidebar becomes a smart top header using Grid areas */
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem 1rem 0 1rem;
        border-radius: 0;
        border-bottom: 1px solid var(--border-light);
        border-right: none;
        box-shadow: none;
        position: relative;
        top: 0;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo user"
            "nav nav";
        gap: 1rem;
        align-items: center;
        z-index: 100;
        /* Ensure mobile dropdowns render strictly above main content */
    }

    .sidebar-header {
        grid-area: logo;
        margin: 0;
        padding: 0;
        justify-content: flex-start;
    }

    .sidebar-nav {
        grid-area: nav;
        margin: 0;
        display: none;
        /* Hide by default on mobile */
        flex-direction: column;
        /* Stack vertically */
        padding-top: 1rem;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
        border-top: 1px solid var(--border-light);
        margin-top: 0.5rem;
    }

    .sidebar-nav.show {
        display: flex;
        /* Display when hamburger toggle is active */
    }

    .nav-item {
        white-space: normal;
        padding: 0.85rem 1.25rem;
        font-size: 1rem;
        background: transparent;
        border: none;
        border-radius: var(--radius-md);
        flex-shrink: 0;
    }

    .nav-item.active {
        background: var(--bg-surface);
        border: 1px solid var(--border-light);
        font-weight: 600;
    }

    .nav-item::before,
    .nav-item.active::before {
        display: none !important;
    }

    .sidebar-footer {
        grid-area: user;
        margin: 0;
        padding: 0;
        border: none;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .client-info {
        margin-bottom: 0;
    }

    .client-info .info {
        display: none !important;
    }

    .sidebar-footer .logout-link {
        font-size: 0 !important;
        margin-left: 0.75rem;
        padding: 0.5rem;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-footer .logout-link i {
        font-size: 1.25rem;
        margin: 0;
    }

    /* Content Area */
    .main-content {
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    .top-header {
        padding: 1.5rem 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        position: static;
    }

    .page-title {
        font-size: 1.5rem;
        letter-spacing: -0.5px;
    }

    .page-subtitle {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-top: 0.25rem;
    }

    .column-title {
        font-size: 1rem;
    }

    .task-title {
        font-size: 1.05rem;
    }

    .task-excerpt {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .board-container {
        padding: 1rem;
        flex-direction: column;
        flex-wrap: nowrap;
        display: flex;
    }

    .board-column {
        min-width: 100%;
        margin-bottom: 1.5rem;
    }

    /* Swap column order on mobile phones (Done > Prev > Queue) */
    .board-column:nth-child(1) {
        order: 3;
    }

    /* Fronta (Queue) goes to bottom */
    .board-column:nth-child(2) {
        order: 2;
    }

    /* Ve vývoji remains in middle */
    .board-column:nth-child(3) {
        order: 1;
    }

    /* Hotové (Done) comes to top */

    .column-header {
        position: static;
    }

    .custom-modal .modal-dialog {
        margin: 0.5rem;
    }
}