/* ==========================================================================
   1. BASE & GLOBAL STYLES
   ========================================================================== */

/* Reset default margins/padding and use border-box sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global body styles */
body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
}

/* Remove underline from all links */
a {
    text-decoration: none;
}

/* Global heading styles */
h1,
h2 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

/* ==========================================================================
   2. TABLE STYLES
   ========================================================================== */

/* Basic table styling */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    margin-bottom: 20px;
}

/* Table borders */
table,th,td {
    border: 1px solid #ccc;
}

/* Padding & text alignment for table cells */
th,td {
    padding: 10px;
    text-align: left;
}

/* Table header styling */
th {
    color: white;
    background-color: #4c4c4c;
}

/* Hover effect on table rows */
tr:hover {
    background-color: #f3f3f3;
}

/* ==========================================================================
   3. FORM & INPUT STYLES
   ========================================================================== */

/* Base form layout */
form {
    display: flex;
    flex-direction: column;
}

/* Input fields and textarea styling */
form input[type="text"],
form input[type="date"],
form input[type="time"],
form textarea {
    width: 100%;
    padding: 8px;
    margin: 4px 0 10px 0;
    box-sizing: border-box;
}

/* Additional form container overrides */
.form-container {
    margin-left: auto;
    margin-right: auto;
    flex: 1; /* or a specific width like 40% */
    max-width: 600px; /* optional max-width */
}

/* Center the form inside its container */
.form-container form {
    max-width: 600px;
    margin: 0 auto;
}

/* Inline Form */
form.inline-form {
    display: inline;
}

/* ==========================================================================
   4. BUTTON STYLES
   ========================================================================== */

/* Delete button styling */
.delete_button {
    background-color: red;
    color: white;
    border: none;
    width: 90px;
    padding: 10px 20px;
    cursor: pointer;
    align-self: flex-start;
}
.delete_button:hover {
    background-color: #820000;
    transition: 0.3s;
}

/* Abort button styling */
.abort_button {
    background-color: red;
    color: white;
    border: none;
    width: 200px;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    align-self:center;
}

/* Edit button styling */
.edit_button {
    background-color: #5cb85c;
    color: white;
    border: none;
    width: 90px;
    padding: 10px 20px;
    cursor: pointer;
    align-self: flex-start;
}
.edit_button:hover {
    background-color: #4a924a;
    transition: 0.3s;
}

/* Attendee button with Material icon */
.attendee_button {
    background-color: #7d8bf8;
    color: white;
    border: none;
    width: 90px;
    padding: 10px 10px;
    cursor: pointer;
    font-weight: bold;
    align-self: center;
}

.attendee_button:hover{
    background-color: #545da5;
}

/* General submit button styling */
.button_submit {
    background-color: #5cb85c;
    color: white;
    border: none;
    width: 200px;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    align-self:center;
}
.button_submit:hover {
    background-color: #4cae4c;
}

/* Edit class submit button styling */
.edit_class_submit_button {
    background-color: #e8b851;
    color: white;
    border: none;
    width: 200px;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    align-self:center;
}
.edit_class_submit_button:hover{
    background-color: #a7853a;
}

/* ==========================================================================
   5. MESSAGE & TYPOGRAPHY STYLES
   ========================================================================== */

/* Paragraph text styling */
p {
    color: green;
    text-align: center;
}

/* Message container styles */
.message {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
}
.success {
    background-color: #d4edda;
    color: #155724;
}
.error {
    background-color: #f8d7da;
    color: #721c24;
}

.success-message {
    color: green;
    text-align: center;
    /* Center messages */
    margin-bottom: 20px;
}

.error-message {
    color: red;
    text-align: center;
    /* Center messages */
    margin-bottom: 20px;
}

/* ==========================================================================
   6. CARD & CONTAINER STYLES
   ========================================================================== */

/* Container for class cards */
.classes-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    /* Space between cards */
}

/* Individual class card styling */
.class-card {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    /* Slightly rounded corners */
    padding: 20px;
    width: 300px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.class-card h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.class-card p {
    margin-bottom: 10px;
    color: #555;
}

.class-card p strong {
    color: #333;
}

/* ==========================================================================
   7. MODAL STYLES
   ========================================================================== */

/* Modal container */
.modal {
    display: none;           /* Hidden by default */
    position: fixed;
    z-index: 1000;
    padding-top: 100px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

/* Modal Content */
.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 20px;
    border: 1px solid #e5e5e5;
    width: min(90%, 560px);   /* snyggare responsiv bredd */
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* Close Button */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* --- Lista i modalen (deltagare) --- */
#attendeeList {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    max-height: 60vh;        /* scrollbar om listan blir lång */
    overflow-y: auto;
}

#attendeeList .attendee-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

#attendeeList .attendee-name {
    flex: 1 1 auto;          /* trycker knappen till höger */
    min-width: 0;            /* krävs för ellipsis i flex */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#attendeeList .unregister-btn {
    margin-left: auto;       /* högerjustera */
    border: 0;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f4f4f4;
    cursor: pointer;
    font: inherit;
    line-height: 1;
}
#attendeeList .unregister-btn:hover {
    background: #ffe6e6;
}
#attendeeList .unregister-btn:active {
    transform: translateY(1px);
}

/* Små skärmar */
@media (max-width: 640px) {
    .modal-content {
        width: 92%;
        padding: 16px;
    }
    #attendeeList .attendee-item {
        padding: 8px 10px;
    }
}
/* ==========================================================================
   8. ADMIN LAYOUT (TWO-COLUMN) STYLES
   ========================================================================== */

/* Container for side-by-side layout of form & table on larger screens */
.admin-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}
.form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 10px;
}
.form-container input,
.form-container textarea {
    width: 100%;
    box-sizing: border-box;
}
.table-container {
    flex: 1; /* or a specific width like 60% */
}
/* ==========================================================================
   9. RESPONSIVE STYLES
   ========================================================================== */

/* Adjust layout for tablets and smaller screens */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    .form-container,
    .table-container {
        width: 100%;
    }
    .classes-container {
        flex-direction: column;
        align-items: center;
    }

    .class-card {
        width: 90%;
        /* Adjust card width for smaller screens */
    }
}

/* Further adjustments for smartphones */
@media (max-width: 480px) {

    h1,h2 {
        font-size: 1.5em;
    }

    th,td {
        padding: 10px;
    }

    form input[type="submit"] {
        padding: 12px;
    }

    table {
        display:table;
        overflow-x: auto;
        white-space: nowrap;
    }

    .class-card {
        padding: 15px;
    }

    .registration-form input[type="text"] {
        padding: 6px;
    }

    .registration-form button {
        padding: 8px;
    }
}

/* Adjust table width for larger screens */
@media (min-width: 1024px) {
    table {
        width: auto;
        max-width: 75%;
        margin: 0 auto 20px;
    }
}

/* Sign up page */
.registration-form {
    display: flex;
    flex-direction: column;
}

.registration-form input[type="text"] {
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.registration-form button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.registration-form button:hover {
    background-color: #2980b9;
}

.class-full {
    background-color: #f8d7da;
    /* Light red background */
}

.class-full .class-full {
    color: #721c24;
    /* Dark red text */
}

.class-full p.class-full {
    color: #721c24;
    font-weight: bold;
    text-align: center;
}


/* On smaller screens, stack them vertically */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
}


/* Table styling */
table {
    width: 100%;
}

/* Hide the mobile card view on larger screens */
.mobile-view { display: none; }

/* Display the card layout on small screens */
@media (max-width: 480px) {
    .desktop-view { display: none; }
    .mobile-view { 
        display: flex; 
        flex-direction: column; 
        gap: 15px;
    }
    .class-card {
        font-size: 0.9em; /* slightly smaller font */
    }
    .class-card .actions {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
    }
}

  .badge-registered {
    display: inline-block;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 9999px;
    background: #e6ffed;
    color: #046c4e;
    border: 1px solid #b7f5c5;
    margin-bottom: 8px;
  }
  .btn-disabled {
    opacity: 0.6;
    pointer-events: none;
  }