:root {
    --main-brand-colour: #06c;
    --secondary-brand-colour: #2c3e50;
}


/* DEFAULTS */

html, body, div, span, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, a, article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section {
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
}

html {
	box-sizing: border-box;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;

}

*, *:before, *:after {
	box-sizing: inherit;
}

ul, ol {
    list-style-position: inside;
}

nav menu, footer menu {
	list-style-type: none;
}

b, strong {
    font-weight: bolder;
}

button, input, optgroup, select, textarea {
  font-family: inherit;
  font-size: 100%;
  margin: 0;
}


/* LAYOUT */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > header {   
    padding: 1rem;
    
    & > div {
        display: flex;
        justify-content: space-between;
    }
    
    & #branding {
        display: flex;
        gap: 2rem;
    }
}

main {
    padding: 3rem 1rem;
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    
    & p {
        margin-bottom: 1em;
    }
    
    & #subnav {
        padding: 1em;      
        background-color: var(--main-brand-colour);
        border-radius: 6px 6px 0 0;
        & ul {
            display: flex;
            gap: 3em;
            justify-content: flex-start;            
            & li {
                font-size: 1.125rem;
                list-style-type: none;
                text-transform: uppercase;
                & a {
                    color: #fff;
                }
            }
        }
    }
}


section.primary, .detail-container {
    background-color: #ffffff;
    padding: 2em 1em 1em 1em;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

section.primary {
    & > footer {
        margin: 2em -1em -1em -1em;
        border-radius: 0 0 0.5rem 0.5rem;
        padding: 1em;
        background-color: var(--main-brand-colour);
        & #record-nav {
            display: flex;
            gap: 2em;
        }
    }
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 2rem;
    & > div > div {
        margin-bottom: 1.5em;
    }
    & dt {
        font-weight: bold;
        color: #555;
        margin-bottom: 0.25em;
    }
}

h1 {
    margin-bottom: 1em;
}

form {
    & #id_associated_classes {
        & > div {
            margin-bottom: 0.5em;
            & input[type=checkbox] {
                margin-right: 0.5em;
            }
        }
    }
}

.hideable {
    display: none;
}

     
/* TYPOGRAPHY */

body {
    font-family: "Open Sans", Roboto, Helvetica, Arial, sans-serif;
    font-size: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1.125rem;
    margin-bottom: 1em;
}

#site-title {
    font-weight: bold;
    font-size: 1.1rem;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* COLOUR SCHEME */

body {
    background-color: #f3f3f9;
    color: #333;
}

body > header {
    background-color: var(--secondary-brand-colour);
    color: #ecf0f1;
}

h1, h2, h3 {
    color: var(--main-brand-colour);
}

#site-title {
    color: #ecf0f1;
}

a {
    color: #0086df;
}

.active {
    color: #ff0;
}

.alert {
    color: #f00;
}


/* MOBILE MENU */

#main-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 0;
    background-color: var(--main-brand-colour);
    z-index: 10;
    overflow: hidden;
    padding-top: 2.75em;
    transition: 0.25s;  

    &.open {
        width: 24rem;
        max-width: 100%
    }
    
    & h2 {
        background-color: #666;
        color: #ecf0f1;
        margin: 0;
        padding: 0.5rem 2rem;
        border-top: 1px solid #ecf0f1;
        border-bottom: 1px solid #ecf0f1;
    }
    
    & menu {
        padding: 0.5em 2rem;
        white-space: nowrap;
        
        & li {
            padding: 0.5em 0;
        };
        
        & a {
            text-transform: uppercase;
            font-size: 1.25em;
            color: #fff;
        };

        & .nav-links {
            list-style: none;
            margin: 0;
            padding: 0;
        };

        & .nav-links a {
            color: #ecf0f1;
        };
    }
}

#menu-open-button, #menu-close-button {
    cursor: pointer;
    position: absolute;
    line-height: 1;
}

#menu-open-button {
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.8rem; /* The size of the hamburger icon */
}

#menu-close-button {
    top: 0;
    right: 0.3rem;
    font-size: 2.5rem; /* Change this so that the 'X' looks the same size as the hamburger icon */
    padding: 0;
}

/* IMAGES */

img {
    width: 100%;
}

#logo {
    width: 3rem;
}


/* TABLES */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

tr {
    border: 1px solid #ddd;
}

thead {
    background-color: #34495e;
    color: #ecf0f1;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #f1f1f1;
}

th {
    display: none;
}

td {
    padding: 0.5em 1em;
    border: 0;
    text-align: left;
    display: block;
}
    

/* BUTTONS and BUTTON-LIKE LINKS */

.button {
    display: inline-block;
    background-color: #3498db;
    color: #fff;
    padding: 0.5em 1em;
    border-radius: 0.25em;
    font-weight: bold;
    text-align: center;
    text-wrap: nowrap;
}

.button:hover {
    background-color: #2980b9;
    text-decoration: none;
}

.button-danger {
    background-color: #e74c3c;
}

.button-danger:hover {
    background-color: #c0392b;
}

.button-secondary {
    background-color: #7f8c8d;
}

.button-secondary:hover {
    background-color: #6c7a7b;
}

/* Simple Info Box */
.info-box {
    background-color: #eaf2f8;
    border-left: 5px solid #3498db;
    padding: 15px;
    margin-top: 1rem;
}


/* Detail View Specifics */


.detail-item strong {
    display: block;
    color: #555;
}

.detail-item p {
    margin: 0;
    font-size: 1.1rem;
}

.back-link-container {
    margin-top: 2rem;
}

/* Category Detail */

.detail-description {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.detail-description p {
    margin-top: 0.5rem;
    line-height: 1.6;
}

.event-section {
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fdfdfd;
}

.event-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Event form */

.form-container {
    max-width: 44rem;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    font-size: 1rem;
    font-family: inherit;
}

/* Styling for multi-select boxes used for ManyToManyFields */
.form-group select[multiple] {
    height: 10rem;
}

.help-text {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.error-text {
    color: #c0392b;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 1rem; /* Adds space between buttons */
}

/* Event delete confirmation */

.warning-box {
    background-color: #fef9e7; /* A light yellow */
    border-left: 5px solid #f1c40f; /* A stronger yellow */
    padding: 1em;
    margin: 1.5rem 0;
}

.warning-box p {
    margin: 0;
}

/* Login */

.login-container { max-width: 400px; margin: 2rem auto; padding: 2rem; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; }
.error-box { background-color: #f8d7da; color: #721c24; padding: 10px; border: 1px solid #f5c6cb; border-radius: 5px; margin-bottom: 1rem; }

/* Logout */
.logout-button {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit; /* Use the same font as the rest of the page */
    font-size: inherit;   /* Use the same font size */
    color: #ecf0f1;      /* Use the same color as your other nav links */
    cursor: pointer;
    text-decoration: none; /* Remove underline that buttons sometimes have */
}

.logout-button:hover {
    text-decoration: underline; /* Add underline on hover, just like a real link */
}

/* MESSAGES */

.messages {
	margin: 1em 0;
	& .message {
		margin-bottom: 0.5em;
		color: #f00;
	}
}

/* Styles for the error pages */
.error-container {
    max-width: 38rem;
    margin: 4rem auto;
    padding: 2rem;
    text-align: center;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.error-container h1 {
    color: #c0392b; /* A soft red for emphasis */
    margin-bottom: 1.5rem;
}

.subtle-error {
    font-style: italic;
    color: #7f8c8d; /* A muted grey */
    background-color: #f9f9f9;
    padding: 0.5rem;
    border-radius: 4px;
}

@media screen and (width >= 66em) {
    body {
        display: grid;
        grid-template-columns: 1fr 64rem 1fr;
        grid-template-rows: max-content 1fr;
        grid-template-areas: "header header header"
                             ". main .";
    }
    
    body > header {
        grid-area: header;
    }
    
    #main-menu {
        grid-area: mainmenu;
    }
    
    main {
        grid-area: main;
        padding: 3rem 0;
    }
    
    section.primary > header {
        display: flex;
        justify-content: space-between;
        margin-bottom: 2rem;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    td.hideable, th.hideable {
        display: table-cell;
    }        

    /* TYPOGRAPHY */

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }
    
    #site-title {
        font-size: 2rem;
    }
	
	li.active {
		border-bottom: 2px solid var(--main-brand-colour);
	}
    
    #logo {
        width: 6rem;
    }

    /* TABLES */
    
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 1rem;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    tr {
        border: 0;
    }

    th, td {
        padding: 0.5em 1em;
        border: 1px solid #ddd;
        text-align: left;
        display: table-cell;
    }

    thead {
        background-color: #34495e;
        color: #ecf0f1;
    }

    tbody tr:nth-child(even) {
        background-color: #f9f9f9;
    }

    tbody tr:hover {
        background-color: #f1f1f1;
    }
   
}


@media screen and (width >= 82em) {
    
    /* LAYOUT */
    
    body {
        grid-template-columns: max-content 64rem 1fr;
        grid-template-areas: "header header header"
                             "mainmenu main .";
        column-gap: 2rem;
    }
    
    #main-menu {
        position: static;
        width: 100%;
        max-width: 100%;
        height: auto;
        transition: none;
        padding-top: 0;
    }
    
    #menu-open-button, #menu-close-button {
        display: none;
    }
    
}