/* Responsive Styles for Small Devices */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        width: 100%;
        
    }

    .admin-sticky .header-container {
        position: sticky;
        top: 0;
        z-index: 1000;
        background-color: #333;
    }

    nav ul li {
        display: block;
        margin: 5px 0;
    }

    nav ul {
        text-align: center;
        padding-left: 0;
    }



    table {
        font-size: 14px;
        width: 100%;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }

    table th, table td {
        padding: 5px;
        min-width: 80px;
    }

    .password-toggle {
        display: flex;
        align-items: center;
        margin-top: 6px;
    }

    .password-toggle input[type="checkbox"] {
        display: none;
    }

    .password-toggle label.switch {
        position: relative;
        display: inline-block;
        width: 40px;
        height: 20px;
        background-color: #ccc;
        border-radius: 34px;
        cursor: pointer;
        transition: background-color 0.2s;
        margin-right: 10px;
    }

    .password-toggle label.switch::before {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 16px;
        height: 16px;
        background-color: white;
        border-radius: 50%;
        transition: transform 0.2s;
    }

    .password-toggle input[type="checkbox"]:checked + label.switch {
        background-color: #007BFF;
    }

    .password-toggle input[type="checkbox"]:checked + label.switch::before {
        transform: translateX(20px);
    }

    .password-toggle span {
        font-size: 12px;
        color: #333;
    }

    form label {
        display: block;
        margin-top: 10px;
    }

    #search, #sort {
        display: block;
        width: 80%;
        margin-bottom: 10px;
        margin-right: 0;
    }

    .edit-form {
        padding: 15px;
        margin: 0 10px;
    }

    .login-form {
        max-width: 800px;
        margin: 120px auto;
        padding: 25px;
        font-size: 18px;
        background: #f9f9f9;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .login-form .form-group {
        margin-bottom: 20px;
    }

    .login-form .form-group label {
        font-size: 20px;
        margin-bottom: 10px;
        display: block;
        font-weight: bold;
    }

    .login-form .form-group input {
        font-size: 18px;
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
        border: 1px solid #ccc;
        border-radius: 4px;
    }

    .login-form .form-group label input[type="checkbox"] {
        width: auto;
        margin-right: 5px;
    }

    .edit-form .form-group label input[type="checkbox"] {
        width: auto;
        margin-right: 5px;
    }

    .login-form .form-actions .btn-primary {
        font-size: 20px;
        padding: 20px;
        width: 100%;
        background: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
    }

    .add-user-form {
        padding: 15px;
        margin: 10px;
    }

    .form-actions {
        text-align: center;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        margin: 5px 0;
        display: block;
    }

    .server-time {
        font-size: 12px;
        margin-top: 5px;
    }

    .welcome-card {
        padding: 20px;
    }

    .welcome-card h1 {
        font-size: 2em;
    }

    .profile-card {
        padding: 20px;
    }

    .profile-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .label {
        flex: none;
        font-size: 14px;
    }

    .value {
        text-align: left;
        font-size: 14px;
    }

    .c20-container {
        display: block;
    }

    .c20-column {
        margin-bottom: 20px;
        width: calc(100% + 20px);
        margin-left: -10px;
        margin-right: -10px;
        padding: 10px;
        box-sizing: border-box;
    }

    /* Mobile tweaks for C20 vinyl widget */
    .c20-vinyl-widget {
        margin: 0 -10px;
        padding: 8px 10px;
        box-sizing: border-box;
        background: transparent;
    }

    .table-site-overview-c20-vinyl {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .c20-vinyl-widget .vinyl-widget-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 6px;
        display: block;
        overflow: visible;
        box-sizing: border-box;
    }

    .c20-vinyl-widget .vinyl-widget-table th,
    .c20-vinyl-widget .vinyl-widget-table td {
        padding: 8px 10px;
        border-bottom: 1px solid #f5f5f5;
        text-align: left;
        vertical-align: middle;
        min-width: 60px;
    }

    .c20-vinyl-widget .vinyl-title-cell {
        white-space: normal;
        overflow-wrap: break-word;
        word-break: break-word;
        font-size: 13px;
        line-height: 1.3;
    }

    #planned .c20-column, #completed .c20-column {
        width: 100vw;
        margin-left: -10px;
        margin-right: -10px;
        padding: 10px;
        box-sizing: border-box;
        position: relative;
        border-radius: 5px;
        background: transparent;
        border: 1px solid;
        border-image: linear-gradient(var(--angle), #800080, #38f9d7, #ff69b4, #43e97b, #ffff00) 1;
        animation: rainbowShift 4s ease-in-out infinite;
        --angle: 0deg;
    }

    .planned-item {
        min-height: 50px;
        padding: 10px;
        margin: 8px 0;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Make sticky elements static on mobile */
    .sticky-buttons {
        position: static;
        display: block;
        text-align: left;
        width: 60%;
        margin: 0;
    }

    .sticky-buttons-1, .sticky-buttons-2 {
        font-size: 14px;
        padding: 5px 0;
        flex-direction: column;
        align-items: stretch;
    }

    .sticky-column {
        position: static;
    }

    .sticky-buttons-1 input, .sticky-buttons-1 button, .sticky-buttons-2 button {
        font-size: 12px;
        padding: 4px 8px;
    }

    .sticky-buttons-1 input[type="text"] {
        padding: 6px;
        max-width: 150px;
    }

    /* Change button text on mobile */
    button[onclick*="window.location.href"] {
        position: relative;
        font-size: 0;
    }

    button[onclick*="window.location.href"]::before {
        content: "Back";
        font-size: 12px;
        position: static;
    }

    #nav-menu {
        position: static;
    }

    /* Mobile styles for status modal */
    #status-modal {
        width: 100vw !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
    }

    #status-modal div {
        width: 100% !important;
        max-width: none !important;
        padding: 30px !important;
        font-size: 18px !important;
        border-radius: 0 !important;
    }

    /* Button widths for mobile */
    #save-settings {
        width: 150px;
    }

    #reset-settings {
        width: 80px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    nav ul li {
        margin: 5px 0;
    }

    .header-container {
        padding: 0 10px;
    }

    .form-container {
        max-width: 100%;
        margin: 10px;
        padding: 15px;
    }

    /* General mobile improvements */
    .card {
        padding: 15px !important;
        margin: 10px 0 !important;
    }

    .alert {
        padding: 10px !important;
        margin: 10px 0 !important;
        font-size: 14px !important;
    }

    .error-message {
        padding: 10px !important;
        margin: 10px 0 !important;
        font-size: 14px !important;
    }

    /* Improve button spacing on mobile */
    .btn-primary, .btn-secondary {
        margin: 5px !important;
        padding: 12px 20px !important;
        font-size: 16px !important;
        min-width: 120px !important;
    }

    /* Better form spacing */
    .form-group {
        margin-bottom: 15px !important;
    }

    .form-group label {
        display: block !important;
        margin-bottom: 5px !important;
        font-size: 16px !important;
    }

    /* Admin panel improvements */
    .admin-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .admin-controls button, .admin-controls a {
        width: 100%;
        text-align: center;
        padding: 12px;
        font-size: 16px;
    }

    /* Statistics cards */
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
        text-align: center;
        border-radius: 8px;
    }

    /* Filter forms */
    .filter-form {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* Better spacing for content */
    .container > * {
        margin-bottom: 15px;
    }

    .container > *:last-child {
        margin-bottom: 0;
    }

    /* Improve readability */
    p, li {
        line-height: 1.5;
    }

    /* Better link spacing */
    a {
        display: inline-block;
        margin: 2px 0;
    }

    /* Admin users table specific styles */
    .admin-users-table {
        font-size: 14px;
        width: 100%;
    }

    .admin-users-table th,
    .admin-users-table td {
        padding: 8px;
        text-align: left;
    }

}

.button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

@media (max-width: 768px) {
    .button-container {
        flex-direction: column;
        align-items: center;
    }
    .button-container .btn-secondary {
        margin-left: 0;
    }
    .c20-widget div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: center !important;
    }
}

.dropdown-trigger {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    border: 1px solid #fff;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
}

.dropdown {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 260px;
    background-color: #f9f9f9;
    box-shadow: -8px 0 16px rgba(0,0,0,0.2);
    z-index: 1005;
    border-left: 1px solid #ccc;
    transform: translateX(100%);
    transition: transform .25s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 0;
    padding-bottom: 20px;
}

.dropdown li a {
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
    color: #333 !important;
    font-size: 14px;
}

.dropdown.open {
    transform: translateX(0);
}

@media(max-width: 768px) {
    .dropdown {
        width: 320px;
        padding-top: 18px;
        box-sizing: border-box;
    }

    .dropdown .group {
        padding: 12px 20px;
        font-weight: 600;
        color: #233041;
        font-size: 14px;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        text-transform: uppercase;
        letter-spacing: .5px;
    }

    .dropdown li a {
        display: block;
        padding: 16px 20px;
        color: #0b2b45;
        font-size: 16px;
        text-decoration: none;
        border-bottom: 1px solid rgba(0,0,0,0.03);
    }

    .dropdown li a:hover {
        background: rgba(0,0,0,0.02);
        color: #001522;
    }

    .dropdown .spacer {
        height: 10px;
    }

    .dropdown .footer-links {
        padding: 12px 20px;
        font-size: 12px;
        color: #557089;
    }

    .dropdown {
        max-height: 100vh;
        -webkit-overflow-scrolling: touch;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }

    .dropdown li a {
        font-size: 16px;
        padding: 16px 20px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .dropdown li:last-child {
        border-top: 2px solid #e0e0e0;
        margin-top: 20px;
        padding-top: 10px;
        position: sticky;
        bottom: 0;
        background-color: #f9f9f9;
    }

    .dropdown li:last-child a {
        background-color: #dc3545;
        color: #fff !important;
        font-weight: bold;
        text-align: center;
        margin: 8px 14px;
        border-radius: 6px;
        display: block;
        font-size: 13px;
    }

    .dropdown li:last-child a:hover {
        background-color: #c82333;
        color: #fff !important;
    }

    @media(max-width: 768px) {
        .dropdown li:last-child a {
            margin: 12px 20px;
            border-radius: 8px;
            min-height: 48px;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .dropdown li a {
            min-height: 44px;
            padding: 14px 20px;
        }

        .dropdown .group {
            padding: 14px 20px;
            font-size: 15px;
        }

        .dropdown .group.c20 {
            background-color: rgba(21,101,192,0.12);
            border-left: 4px solid #1565c0;
        }

        .dropdown .group.c30 {
            background-color: rgba(102,26,154,0.12);
            border-left: 4px solid #6a1b9a;
        }
    }

/* Responsive: vinyl overview tables (stack rows on small screens) */
@media (max-width: 700px) {
    .table-site-overview-c20-vinyl {
        padding: 0 8px;
        box-sizing: border-box;
    }

    .table-site-overview-c30-vinyl {
        padding: 0 8px;
        box-sizing: border-box;
    }

    /* Make the table behave like blocks so rows can stack */
    table.vinyl-table {
        display: block;
        width: 100%;
    }

    .c20-vinyl-widget .vinyl-widget-table {
        display: block;
        width: 100%;
    }

    .c30-vinyl-widget .vinyl-widget-table {
        display: block;
        width: 100%;
    }

    /* Hide header and present each row as a card */
    table.vinyl-table thead { display: none; }
    table.vinyl-table tbody tr {
        display: block;
        margin-bottom: 10px;
        padding: 8px;
        border-radius: 8px;
        background: rgba(0,0,0,0.02);
        box-shadow: 0 1px 2px rgba(0,0,0,0.06);
        border: 1px solid rgba(0,0,0,0.02);
    }

    /* Each cell becomes a line with label on the left and value on the right */
    table.vinyl-table tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 8px;
        border-bottom: none;
        min-width: 0; /* allow shrinking */
    }

    /* Prefer explicit data-label when available (C30 uses data-label attr) */
    table.vinyl-table tbody tr td:before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 8px;
        color: #333;
        flex: 0 0 45%;
        max-width: 45%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Fallback labels for tables without data-label (C20) */
    table.vinyl-table tbody tr td:not([data-label]):nth-child(1):before { content: "ID"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(2):before { content: "Main Title"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(3):before { content: "Kampanj"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(4):before { content: "Veckintervall"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(5):before { content: "Progress"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(6):before { content: "Status"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(7):before { content: "Aktiv"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(8):before { content: "Visa"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(9):before { content: "Registrera"; }
    table.vinyl-table tbody tr td:not([data-label]):nth-child(10):before { content: "Fil"; }

    /* Ensure title cells wrap nicely on mobile */
    .vinyl-title-cell { white-space: normal; overflow-wrap: break-word; }

    /* Keep buttons and action cells aligned and shrinkable */
    .button-container a, .button-container span { width: auto; display: inline-block; }
}
}
