/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
}

/* Loading and content visibility */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.content-hidden {
    display: none !important;
}

/* Main content layout */
main {
    margin: 200px 0 100px;
}

#content {
    display: flex;
    flex-direction: column;
    width: calc(100% - 320px);
    margin-left: 320px;
    text-align: center;
    padding: 10px 10px 100px;
    overflow-y: auto;
}

/* Headings */
h1, h2 {
    padding-top: 10px;
}

h3 {
    color: #2d4ba4;
    border-bottom: 1px solid #091844;
    font-size: 20px;
    font-family: arial;
    padding-top: 20px;
    margin-bottom: 10px;
}

.contentHeading {
    max-width: 2400px;
    font-family: arial;
    margin-bottom: 20px;
    padding-bottom: 5px;
    color: #17479b;
    background-color: #c5f1ff;
    text-align: center;
    border: solid #376cfd;
    border-width: 1px 0;
}

.contentContainer {
    max-width: 1400px;
    width: 100%;
    margin: auto;
    padding: 10px;
    text-align: left;
    flex: 1;
}

.contentContainer p,
.contentContainer a,
.contentContainer ul,
.contentContainer ol {
    font-size: 18px;
    padding: 10px;
}

.contentContainer h2 {
    text-align: left;
    color: #0c3f71;
    border-bottom: solid #5252c8;
    font-size: 25px;
    margin: 20px 0;
}

.contentContainer ul {
    list-style-type: circle;
    margin-left: 20px;
}

.contentContainer ul li {
    margin-bottom: 10px;
}

/* Tables */
table {
    border: 1px solid black;
    border-collapse: collapse;
    margin: 20px auto;
    max-width: 1000px;
    width: 100%;
}

table th,
table td {
    border: 1px solid black;
    padding: 10px;
}

table th {
    text-align: center;
    background-color: lightblue;
}

table th p,
table td p {
    margin: 0;
}

.subheader th {
    background-color: lightgreen;
}

.white td {
    background-color: white;
}

/* Specialized tables */
#marks th,
#marks td {
    width: 200px;
    text-align: center;
    border: 1px solid;
}

#marks th {
    background-color: lightblue;
}

.binaryTable th,
.binaryTable td {
    border: solid 1px black;
    text-align: center;
    width: 50px;
    height: 50px;
}

.specifications th,
.specifications td {
    border: 1px solid black;
    padding: 20px;
}

.specifications td ul {
    list-style-type: disc;
}

.specifications td ul li ul {
    list-style-type: square;
}

/* Topic buttons and navigation */
.topicButton {
    max-width: 1000px;
    display: block;
    border: 1px solid;
    border-radius: 10px;
    margin: 10px auto;
    font-size: 20px;
    text-align: center;
    font-weight: bold;
    padding: 20px;
    background-image: linear-gradient(to bottom, lightgrey, lightslategrey);
}

#CSButton:hover, #CSButton.active {
    background-image: linear-gradient(to bottom, lightblue, rgb(73, 161, 196));
}

#SDDButton:hover, #SDDButton.active {
    background-image: linear-gradient(to bottom, palevioletred, rgb(179, 47, 47));
}

#WDDButton:hover, #WDDButton.active {
    background-image: linear-gradient(to bottom, darkseagreen, seagreen);
}

#DDDButton:hover, #DDDButton.active {
    background-image: linear-gradient(to bottom, lightgoldenrodyellow, yellow);
}

.breakdown {
    max-width: 1000px;
    margin: 0 auto;
    display: none;
}

/* Field properties and specifications */
#fieldProperties {
    list-style-type: none;
    max-width: 1000px;
    margin: auto;
}

.fieldtype {
    text-align: center;
    background-image: linear-gradient(to bottom, lightgrey, lightslategrey);
    padding: 5px;
    border: 1px solid black;
    margin: 10px 0;
    font-size: 20px;
    cursor: pointer;
}

.fieldtype:hover,
.fieldtype.active {
    background-image: linear-gradient(to bottom, lightblue, rgb(73, 161, 196));
}

.fieldProperty {
    background-color: #C5E3ED;
    list-style-type: circle;
}

#CSBreakdown .specifications th {
    background-color: lightblue;
}

#SDDBreakdown .specifications th {
    background-color: palevioletred;
}

#WDDBreakdown .specifications th {
    background-color: lightgreen;
}

#DDDBreakdown .specifications th {
    background-color: lightyellow;
}

/* Examples and layouts */
.example1 {
    width: 80%;
    margin: auto;
    text-align: center;
    font-size: 30px;
    background-color: lightyellow;
    padding: 20px;
    border: solid 1px black;
}

.example {
    background-color: #E3FFD8;
    margin-top: 10px;
    padding: 10px;
}

/* Images */
.rImg {
    float: right;
    padding: 20px;
}

.lImg {
    float: left;
    padding: 20px;
}

.cImg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    padding: 20px;
}

.shadow,
.shadowImage {
    border: 1px solid black;
    border-radius: 10px;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.18);
    max-width: 500px;
}

.shadow {
    margin-right: 10px;
}

.shadowImage {
    display: block;
    margin: 0 auto;
}

.ImgAndText {
    display: flex;
    align-content: center;
    justify-content: space-between;
}

.ImgAndText img {
    padding: 20px;
}

/* Buttons */
.button,
.button2 {
    width: 200px;
    margin: auto;
    display: block;
    padding: 10px;
    border: 1px solid black;
    border-radius: 10px;
    background-image: linear-gradient(to bottom, lightgrey, lightslategrey);
    height: auto;
    text-align: center;
}

.button {
    font-size: 20px;
    margin-top: 20px;
    font-weight: bold;
}

.button a,
.button2 a {
    text-decoration: none;
    color: black;
    display: block;
}

.button2 a {
    font-size: 15px;
    font-weight: bold;
}

.button:hover {
    background-image: linear-gradient(to bottom, lightblue, rgb(73, 161, 196));
    cursor: pointer;
}

.answerButton {
    border: 1px solid black;
    border-radius: 10px;
    padding: 10px;
    background-image: linear-gradient(to bottom, lightgrey, lightslategrey);
    margin: auto;
    display: block;
    width: 200px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
}

/* Special elements */
.mi {
    background-color: #238caf;
}

ol li {
    padding: 10px 0;
    margin-left: 30px;
}

.hiddenElement {
    display: none;
}

/* Code styling */
.codeBox {
    max-width: 800px;
    margin: 20px auto;
    text-align: left;
    padding: 20px;
    border: solid 1px black;
    background-color: #1c2112;
    color: white;
    font-family: "Courier New", Courier, monospace;
}

.codeBox p {
    margin: 0;
    padding: 0;
}

.codeBox table,
.codeBox th,
.codeBox td {
    border: none;
    padding: 0;
}

.pseudocode {
    font-family: "Courier New", Courier, monospace;
    text-align: left;
    margin: 20px auto;
    background-color: white;
    color: black;
    padding: 5px;
    max-width: 800px;
}

.pseudocode th {
    font-family: arial;
    text-align: center;
    background-color: lightblue;
    padding: 5px 0;
}

.pseudocode td {
    padding: 5px 0;
}

.codeText {
    font-family: "Courier New", Courier, monospace;
}

.borderless table,
.borderless th,
.borderless td {
    border: none;
    background-color: transparent;
}

/* Layout containers */
.tutorial {
    margin: auto;
    max-width: 1000px;
}

.trinket {
    width: 75%;
    height: 400px;
    margin: 20px auto;
    display: block;
}

.sideBySide {
    display: flex;
    align-content: center;
    justify-content: center;
    margin: 20px auto;
}

.vertAlign {
    align-items: center;
}

.htmlCode {
    border: 1px solid black;
    margin: 10px auto;
    padding: 20px;
    font-family: "Courier New", Courier, monospace;
}

.htmlCode pre {
    margin-left: -200px;
}

/* List styling */
ul li ul li {
    list-style-type: square;
}

ul li ul li ul li {
    list-style-type: disc;
}

/* Interactive elements */
.laws {
    background-image: linear-gradient(to bottom, lightgrey, lightslategrey);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 10px;
    border: 1px solid black;
}

.arrow {
    margin-left: auto;
    transition: all 0.3s ease-in-out;
    display: inline-block;
    transform: rotate(0deg);
    font-size: 16px;
}

.arrow.rotated {
    transform: rotate(90deg);
}

.law-content {
    transition: all 0.5s;
    padding-left: 20px;
}

/* GDPR specific styling */
#GDPRPrinciples {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    max-width: 1000px;
}

#GDPRPrinciples li {
    width: 100%;
    max-width: 1000px;
}

#GDPRPrinciples div div {
    background-color: lightgrey;
}

#GDPRPrinciples ol li {
    max-width: 1000px;
}

#GDPRPrinciples div ul li {
    padding-right: 50px;
}

/* Mobile Landscape - Content adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    #content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 10px;
        align-items: center;
    }

    .contentContainer {
        max-width: 100%;
        padding: 10px;
    }

    .contentContainer p,
    .contentContainer a,
    .contentContainer ul,
    .contentContainer ol {
        font-size: 14px;
        line-height: 1.3;
    }

    .contentContainer h2 {
        font-size: 18px;
        margin: 10px 0;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .answerButton {
        width: 90%;
        max-width: 200px;
        font-size: 16px;
        padding: 12px 8px;
        margin: 10px auto;
        touch-action: manipulation;
    }

    #content {
        width: 100%;
        margin-left: 0;
        padding: 15px;
        align-items: center;
    }

    .contentContainer {
        max-width: 100%;
        margin: 10px auto;
        padding: 15px;
    }

    .contentHeading {
        width: 100%;
        margin: 0 auto;
    }

    .contentContainer p,
    .contentContainer a,
    .contentContainer ul,
    .contentContainer ol {
        font-size: 14px;
        line-height: 1.4;
    }

    .contentContainer h2 {
        font-size: 20px;
        margin: 15px 0;
    }

    .contentContainer h3 {
        font-size: 16px;
        margin: 10px 0 8px;
    }

    .contentContainer ul li,
    .contentContainer ol li {
        margin-bottom: 5px;
        font-size: 14px;
    }

    /* Table mobile optimizations */
    table {
        display: block;
        border: none;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        font-size: 10px;
        width: 100%;
        max-width: 100%;
        margin: 10px 0;
    }

    table th,
    table td {
        padding: 4px 3px;
        font-size: 12px;
        line-height: 1.3;
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        max-width: 120px;
        min-width: 60px;
        hyphens: auto;
    }

    table td p,
    table th p,
    table td div,
    table td ul,
    table td ol,
    table td li {
        font-size: 12px !important;
        line-height: 1.4 !important;
        margin: 3px 0 !important;
        padding: 0 !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        hyphens: auto;
        max-width: 100% !important;
    }

    table td .codeText,
    table th .codeText {
        font-size: 10px !important;
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        white-space: pre-wrap !important;
    }

    .binaryTable {
        font-size: 11px;
    }

    .binaryTable th,
    .binaryTable td {
        width: 30px;
        height: 30px;
        padding: 3px;
        font-size: 11px;
    }

    .specifications {
        font-size: 11px;
    }

    .specifications th,
    .specifications td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .hiddenElement p,
    .hiddenElement ul,
    .hiddenElement ol,
    .hiddenElement li {
        font-size: 12px !important;
        line-height: 1.4 !important;
        margin: 4px 0 !important;
    }

    /* Image and layout mobile adjustments */
    .contentContainer img,
    .shadow,
    .shadowImage,
    .rImg,
    .lImg,
    .cImg {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
        float: none;
        margin: 10px auto;
        display: block;
    }

    .ImgAndText {
        flex-direction: column;
    }

    .ImgAndText img {
        width: 100%;
        max-width: 300px;
        margin: 10px auto;
    }

    .topicButton {
        width: 100%;
        font-size: 16px;
        padding: 15px 10px;
    }

    .sideBySide {
        flex-direction: column;
    }

    .breakdown {
        width: 100%;
        font-size: 14px;
        padding: 5px;
    }

    .breakdown table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        font-size: 10px;
        width: 100%;
        max-width: 100%;
    }

    .breakdown th,
    .breakdown td {
        padding: 5px;
    }

    .breakdown table td {
        white-space: nowrap;
    }
}