@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

:root {  /* CSS Variables - we can use these variables throughout the CSS file using var(--variable-name) */
    --success-color: #2ecc71;  /* Green color for success */
    --error-color: #e74c3c;    /* Red color for error */
}

* {      /* Affects all elements on the page */
    box-sizing: border-box;     /* Includes padding and border in the element's total width and height, i.e. we do not want any padding to affect the width of the element */
}

body {
    background-color: #f9fafb;  /* Light gray background color for the entire page */
    font-family: 'Open Sans', sans-serif;  /* Sets the default font for the page */
    display: flex;               /* All the direct children of the body element are flex items, and with flex we can easily center elements */
    align-items: center;      /* Vertically centers the flex items */
    justify-content: center;   /* Horizontally centers the flex items */
    min-height: 100vh;        /* Ensures the body takes at least the full height of the viewport */
    margin: 0;                /* We take any margin away */
}

.container {
    background-color: #fff;
    border-radius: 5px;   /* Rounded corners */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);  /* h-offset v-offset blur radius color */
    width: 400px;
}

h2 {
    text-align: center;
    margin: 0 0 20px;   /* Top, right, bottom, left */
}

.form {
    padding: 30px 40px;   /* Top/bottom and left/right padding */
}

.form-control {   /* We have 4 form-control divs */
    margin-bottom: 10px;
    padding-bottom: 20px;
    position: relative;  /* Error tag is going to be "absolute", and for this to work, the parent element has to be "relative" */
}

.form-control label {    /* 4 labels */
    color: #777;
    display: block; /* Makes the label take the full width available - i.e. it is on its own line and kicks the following element down to the next line */
    margin-bottom: 5px;
}

.form-control input {
    border: 2px solid #f0f0f0;
    border-radius: 4px;
    display: block; /* It occupies the full width available */
    width: 100%;
    padding: 10px;
    font-size: 14px;
}

.form-control input:focus {
    outline: 0; /* Removes the default blue outline when input gets a focus */
    border-color: #777;  /* Darker border color when input is focused */
}

.form-control.success input { /* When the form-control div has the class "success" */
    border-color: var(--success-color);  /* Green border color for success */
}

.form-control.error input { /* When the form-control div has the class "error" */
    border-color: var(--error-color);  /* Red border color for error */
}

.form-control small {
    color: var(--error-color);
    position: absolute;
    bottom: 0;
    left: 0;
    visibility: hidden;  /* Hidden by default */
    /* display: none; /* There is a difference: visibility: hidden; keeps the space for the element, but just makes it invisible, whereas display: none; removes the element from the document flow completely and this collapses other elements around it */
}

.form-control.error small { /* When the form-control div has the class "error" */
    visibility: visible;  /* Show the error message */
}

.form button {
    cursor: pointer;
    background-color: #3498db;  /* Blue background color */
    border: 2px solid #3498db;
    border-radius: 4px;
    color: white; /* White text color */
    display: block; /* Takes the full width available */
    font-size: 16px;
    padding: 10px;
    margin-top: 20px;
    width: 100%;
}


