/* Responsive CSS for PlanStyring */
/* Base styles that apply to all screen sizes */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #fff;
    color: #111827;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    padding-bottom: 65px; /* Match the height of the footer */
}

.hamburger-menu {
    display: none;
}

.sidebar {
    width: 250px;
    background-color: white;
    height: 100vh;
    padding: 20px;
    border-right: 1px solid #E5E7EB;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    transition: all 0.3s ease;
}

.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid #E5E7EB;
    padding: 12px 0;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    height: 65px;
    width: 100%;
}

.main-content {
    margin-left: 250px;
    padding: 20px;
    transition: all 0.3s ease;
    padding-bottom: 65px; /* Reduced from 80px to just match footer height */
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.search-section {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.table-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 0; /* Removed margin-bottom to reduce space */
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    font-weight: 600;
    color: #6B7280;
    background: #F9FAFB;
    padding: 12px 16px;
    border-bottom: 1px solid #E5E7EB;
}

td {
    padding: 16px;
    vertical-align: middle;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    color: #6B7280;
    font-size: 14px;
    margin-bottom: 0; /* Ensure no extra margin */
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 20px;
    color: #111827;
    cursor: pointer;
}

.default-action-group {
    display: flex;
    gap: 8px;
}

.action-buttons-mobile {
    display: none;
    gap: 8px;
    position: relative;
}

.action-button-mobile {
    background: none;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
}

.action-button-mobile img {
    width: 20px;
    height: 20px;
}

.ellipsis-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    color: #6B7280;
    padding: 5px 10px;
    text-align: center;
    width: 32px;
    height: 32px;
}

.ellipsis-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 30px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    min-width: 120px;
    padding: 8px 0;
}

.ellipsis-menu.active {
    display: block;
}

.ellipsis-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    color: #374151;
    font-size: 14px;
}

.ellipsis-menu-item:hover {
    background-color: #F9FAFB;
}

.ellipsis-menu-item img {
    width: 16px;
    height: 16px;
}

/* Mobile styles - Only shown on screens ≤740px */
@media (max-width: 1000px) {
    body {
        padding-bottom: 65px;
        min-height: 100vh;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: 65px; /* Reduced from 80px */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #6B7280;
        font-size: 12px;
        position: relative;
        padding: 4px 0;
        flex: 1;
        text-align: center;
    }

    .bottom-nav-item.active {
        color: #007AFF;
    }

    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 3px;
        background-color: #007AFF;
        border-radius: 2px;
    }

    .bottom-nav-item img, .bottom-nav-icon {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
    }

    .bottom-nav-item.active img {
        filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(1843%) hue-rotate(199deg) brightness(97%) contrast(107%);
    }

    .sidebar {
        display: none;
    }

    /* Fix for modal display on mobile */
    .modal {
        padding-bottom: 70px;
    }

    /* Table adjustments for mobile */
    table {
        border-collapse: collapse;
    }

    th {
        padding: 12px 8px;
        text-align: left;
    }

    th:first-child {
        padding-left: 16px;
    }

    th:last-child {
        text-align: center;
    }

    .plan-row {
        border-bottom: 1px solid #E5E7EB;
    }

    .plan-name {
        padding: 14px 16px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .doc-icon {
        min-width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background-color: #EEF2FF;
    }

    .status-cell {
        padding: 14px 4px;
        text-align: center;
    }

    .action-cell {
        padding: 14px 8px;
        text-align: center;
    }

    .status-dot {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: inline-block;
    }

    .ellipsis-menu-toggle {
        font-size: 20px;
        letter-spacing: 1px;
        padding-top: 2px;
        display: inline-block;
    }

    td {
        border: none;
        height: 60px;
        padding: 0;
    }

    tr:last-child {
        border-bottom: none;
    }

    tr:first-child td:first-child {
        border-top-left-radius: 8px;
    }

    tr:first-child td:last-child {
        border-top-right-radius: 8px;
    }

    tr:last-child td:first-child {
        border-bottom-left-radius: 8px;
    }

    tr:last-child td:last-child {
        border-bottom-right-radius: 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .search-section {
        flex-direction: column;
        gap: 12px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header h1 {
        font-size: 24px;
    }

    .pagination {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .page-buttons {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .hide-on-mobile {
        display: none;
    }

    th, td {
        padding: 12px 8px;
        font-size: 14px;
    }

    .default-action-group {
        display: none;
    }

    .action-buttons-mobile {
        display: flex;
        justify-content: flex-end;
    }

    .modal-content {
        width: 95%;
        padding: 16px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }

    .add-button {
        width: 100%;
        justify-content: center;
    }
}

/* Additional mobile adjustments for very small screens */
@media (max-width: 550px) {
    .hide-on-small-mobile {
        display: none;
    }

    th:nth-child(2),
    td:nth-child(2) {
        display: none;
    }

    td.plan-name {
        min-width: 120px;
        width: 60%;
        padding: 12px 16px;
        border-right: none;
    }

    td.status-cell {
        width: 20%;
        padding: 12px 8px;
        text-align: center;
        border-right: none;
    }

    td:last-child {
        width: 20%;
        text-align: center;
        padding: 12px 8px;
    }

    tr.plan-row {
        border-bottom: 1px solid #E5E7EB;
    }

    td {
        border-top: none !important;
        border-right: none !important;
    }
}

/* Tablet styles (741px - 1024px) */
@media (min-width: 741px) and (max-width: 1024px) {
    .hamburger-menu {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .sidebar-close {
        display: block;
    }

    .sidebar {
        left: -250px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 60px 20px 65px 20px; /* Reduced bottom padding */
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop styles (>1024px) */
@media (min-width: 1025px) {
    .bottom-nav {
        display: none; /* Hide only on very large screens */
    }

    body {
        padding-bottom: 0; /* Remove padding on large screens */
    }

    .main-content {
        padding-bottom: 20px; /* Reset padding on large screens */
    }

    .hamburger-menu {
        display: none;
    }
}

/* Hamburger animation */
.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Dragging styles */
.plan-row.dragging {
    opacity: 0.5;
    background-color: #f5f5f5;
}

/* Action cell styles */
.action-cell {
    position: relative;
}

.ellipsis-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 150px;
    overflow: hidden;

}

.ellipsis-menu.active {
    display: block;

}

.ellipsis-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    gap: 12px;
    transition: background-color 0.2s;

}

.ellipsis-menu-item:hover {
    background-color: #F9FAFB;
}

.ellipsis-menu-item img {
    width: 16px;
    height: 16px;
}

.ellipsis-menu-item span {
    font-size: 14px;
    color: #374151;
}

/* Mobile Header Adjustments */
@media (max-width: 740px) {
    /* Hide the breadcrumb on mobile */
    .breadcrumb {
        display: none;
    }

    /* Add the logo to replace breadcrumb */
    .header:before {
        content: '';
        display: block;
        background-image: url('../image/ringerike_logo.png');
        background-size: contain;
        background-repeat: no-repeat;
        width: 30px;
        height: 30px;
        margin-bottom: 10px;
    }

    /* Make header layout flex for better alignment */
    .header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        margin-bottom: 24px;
    }

    /* Style the heading */
    .header h1 {
        font-size: 24px;
        margin-bottom: 10px;
        flex: 1;
    }

    /* Make the add button smaller and position it right */
    .add-button {
        width: auto;
        padding: 8px 12px;
        font-size: 14px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        margin-bottom: 10px;
    }
}