/* assets/css/style.css */

/* Grundläggande stil för responsiv design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color, #333);
    background-color: var(--background-color, #ffffff);
}

header {
    background: linear-gradient(180deg, #f4f4f4, #e0e0e0);
    padding: 10px 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header img {
    max-width: 300px;
}

nav {
    position: relative;
    overflow: visible;
}

nav ul.nav-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    margin: 10px 0;
    background: transparent;
    overflow: visible;
}

nav ul.nav-menu li {
    list-style: none;
    margin: 0 15px;
    position: relative;
}

nav ul.nav-menu li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    padding: 5px 10px;
    display: block;
}

nav ul.nav-menu li a:hover {
    color: #007bff;
}

/* Dropdown-styling */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-width: 150px;
    z-index: 1001;
    overflow: visible;
}

.dropdown-menu li {
    list-style: none;
    margin: 0;
}

.dropdown-menu li a {
    display: block;
    padding: 10px;
    color: #333;
    text-decoration: none;
    text-align: left;
}

.dropdown-menu li a:hover {
    background: #f4f4f4;
    color: #007bff;
}

.dropdown:hover > .dropdown-menu {
    display: block;
}

.dropdown-menu .dropdown {
    position: relative;
}

.dropdown-menu .dropdown-menu {
    top: 0;
    left: 100%;
    min-width: 220px;
    z-index: 1002;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Hamburger-meny */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1002;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: all 0.3s ease;
}

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

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

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

main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-image {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

h1, h2, h3 {
    margin-bottom: 20px;
}

h1 {
    font-size: 2.2em;
    color: var(--text-color, #000000);
}

form {
    max-width: 800px;
    margin: 20px 0;
}

form label {
    margin-bottom: 5px;
    display: block;
    font-weight: bold;
}

form input, form select, form textarea {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

form select[multiple] {
    height: 100px; /* Höjd för multiselect */
}

form button {
    padding: 10px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

form button:hover {
    background: #0056b3;
}

/* Föreningsval (login.php) */
.association-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    margin-top: 20px;
}

.association-buttons button {
    padding: 8px 12px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: fit-content;
    min-width: 150px;
    text-align: left;
    font-size: 16px;
}

.association-buttons button:hover {
    background: #0056b3;
}

.association-select {
    margin-top: 20px;
    text-align: left;
}

.association-select select {
    padding: 8px;
    width: 100%;
    max-width: 300px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

/* Dashboard-val för föräldrar (login.php) */
.dashboard-choice {
    margin-top: 20px;
}

.dashboard-choice a {
    display: inline-block;
    padding: 8px 12px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 10px;
    font-size: 16px;
}

.dashboard-choice a:hover {
    background: #218838;
}

/* Logga ut-knapp */
.logout-button {
    padding: 10px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    max-width: 200px;
    margin-top: 10px;
}

.logout-button:hover {
    background: #c82333;
}

/* Felmeddelanden */
.error {
    color: red;
    margin-bottom: 10px;
}

/* Tabellstilar */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table th, table td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
}

/* Specifik styling för medlemstabellen */
table.member-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9em !important;
    line-height: 1.2 !important;
}

table.member-table tr {
    max-height: 24px !important;
}

table.member-table th,
table.member-table td {
    border: 1px solid #ccc !important;
    padding: 4px 6px !important;
    text-align: left;
    vertical-align: middle !important;
}

table.member-table th {
    background: #e0e0e0 !important;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

table.member-table th:hover {
    background: #d0d0d0 !important;
}

table.member-table th .sort-indicator {
    display: inline-block;
    width: 12px;
    text-align: center;
    font-size: 0.8em;
}

table.member-table tr:nth-child(even) {
    background: #e8e8e8 !important;
}

table.member-table tr:nth-child(odd) {
    background: #ffffff !important;
}

table.member-table tr:hover {
    background: #e6f3ff !important;
}

.edit-button {
    display: inline-block;
    padding: 2px 6px !important;
    font-size: 0.8em !important;
    line-height: 1.2 !important;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    text-align: center;
}

.edit-button:hover {
    background: #0056b3;
}

.association-logo {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
    display: block;
    margin: auto;
    vertical-align: middle;
}

.delete-button {
    background-color: #ff4444;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-top: 10px;
}

.delete-button:hover {
    background-color: #cc0000;
}

.success {
    color: green;
}

footer {
    background: #f4f4f4;
    text-align: center;
    padding: 10px;
    margin-top: 20px;
}

.section-divider {
    margin-bottom: 20px;
}

/* Styling för redigeringsformuläret */
.edit-form {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.edit-form form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.edit-form label {
    display: flex;
    flex-direction: column;
    font-weight: bold;
}

.edit-form input,
.edit-form textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.edit-form textarea {
    min-height: 200px;
    resize: vertical;
}

.edit-form input[type="color"] {
    height: 40px;
    padding: 5px;
}

.edit-form input[type="submit"] {
    background: #007bff;
    color: #fff;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    max-width: 200px;
    align-self: flex-end;
}

.edit-form input[type="submit"]:hover {
    background: #0056b3;
}

button[onclick="toggleEditMode()"] {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button[onclick="toggleEditMode()"]:hover {
    background: #218838;
}

.debt-form {
    text-align: left;
}

.debt-form label,
.debt-form select,
.debt-form input,
.debt-form textarea,
.debt-form button {
    display: block;
    margin-bottom: 10px;
}

.debt-form button {
    padding: 8px 12px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.debt-form button:hover {
    background: #0056b3;
}

/* Responsiv design för mobiler */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    nav ul.nav-menu {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        background: #f4f4f4;
        position: absolute;
        top: 60px;
        right: 0;
        width: auto;
        max-width: 90%;
        z-index: 1001;
        padding: 10px 20px;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    nav ul.nav-menu.active {
        display: flex;
    }

    nav ul.nav-menu li {
        margin: 10px 0;
        width: 100%;
    }

    nav ul.nav-menu li a {
        text-align: left;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        border: none;
        box-shadow: none;
        background: #fff;
        padding-left: 20px;
        text-align: left;
    }

    .dropdown:hover .dropdown-menu {
        display: none;
    }

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

    .dropdown-menu .dropdown-menu {
        position: static;
        left: 0;
        padding-left: 20px;
        border: none;
        box-shadow: none;
        background: #fff;
        min-height: auto;
        display: none !important;
    }

    .dropdown.active .dropdown-menu {
        display: block !important;
    }

    .header-image {
        max-height: 200px;
    }

    .association-logo {
        max-width: 50px;
        max-height: 50px;
    }

    form.association-form {
        display: flex;
        flex-direction: column;
    }

    .edit-form {
        padding: 0 10px;
    }

    .edit-form input[type="submit"] {
        max-width: 100%;
        align-self: stretch;
    }

    .association-buttons button,
    .association-select select,
    .dashboard-choice a,
    .logout-button {
        width: 100%;
        text-align: center;
    }

    main {
        padding: 0 10px;
    }

    table.member-table {
        font-size: 0.85em !important;
    }

    table.member-table th,
    table.member-table td {
        padding: 3px 5px !important;
    }

    .edit-button {
        padding: 1px 4px !important;
        font-size: 0.75em !important;
    }

    form select[multiple] {
        height: 80px; /* Mindre höjd på mobiler */
    }
}