/* =========================================================
   addtaxes.com - Professional Theme
   Mobile-first responsive design
   ========================================================= */

/* ---------------------------------------------------------
   Fonts
   --------------------------------------------------------- */

@font-face {
    font-family: 'montserrat_alternatesmedium';
    src: url('fonts/montserratalternates-medium-webfont.woff2') format('woff2'),
         url('fonts/montserratalternates-medium-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'montserrat_alternateslight';
    src: url('fonts/montserratalternates-light-webfont.woff2') format('woff2'),
         url('fonts/montserratalternates-light-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'biryaniregular';
    src: url('fonts/Biryani-Regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* ---------------------------------------------------------
   Variables
   --------------------------------------------------------- */

:root {
    /* Brand */
    --color-primary: #17324d;
    --color-primary-dark: #102638;
    --color-primary-light: #294b6a;

    /* Canadian accent */
    --color-accent: #d62839;
    --color-accent-dark: #b51f2e;
    --color-accent-light: #fbe8ea;

    /* Backgrounds */
    --color-body: #eef2f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f7f9fb;

    /* Text */
    --color-text: #1f2933;
    --color-text-light: #667482;
    --color-text-button: #ffffff;

    /* Borders */
    --color-border: #d8e0e7;
    --color-border-dark: #aebbc7;

    /* Feedback */
    --color-focus: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 2px 6px rgba(16, 38, 56, 0.08);
    --shadow-md: 0 6px 18px rgba(16, 38, 56, 0.12);
    --shadow-lg: 0 12px 30px rgba(16, 38, 56, 0.16);

    /* Fonts */
    --font-main-header-h1: 'montserrat_alternatesmedium';
    --font-main-header-h2: 'montserrat_alternateslight';
    --font-header-h3: 'biryaniregular';

    /* Radius */
    --radius-sm: 0.4rem;
    --radius-md: 0.7rem;
    --radius-lg: 1rem;
}

/* ---------------------------------------------------------
   Reset / Base
   --------------------------------------------------------- */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    position: relative;
    min-width: 320px;
    max-width: 680px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 1rem 0;
    color: var(--color-text);
    background:
        linear-gradient(
            180deg,
            #e8eef3 0%,
            var(--color-body) 100%
        );
    font-family:
        'Courier New',
        Courier,
        monospace;
    font-weight: 400;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
svg:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* ---------------------------------------------------------
   Animations
   --------------------------------------------------------- */

@keyframes fade-in {
    from {
        opacity: 0;       
    }

    to {
        opacity: 1;
    }
}

@keyframes modal-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------------------------------------------------------
   Headers
   --------------------------------------------------------- */

header {
    margin: auto;
    text-align: center;
    max-width: 680px;
}

h1,
h2,
h3 {
    margin: 0;
}

/* ---------------------------------------------------------
   Main Header
   --------------------------------------------------------- */

#header-main {
    padding-top: 0.4rem;
}

#header-main h1 {
    margin: 0;
    font-family:
        var(--font-main-header-h1),
        'Courier New',
        monospace;
    font-weight: 400;
    font-size: 2.3rem;
    line-height: 1.2;
    color: var(--color-text-button);
    background:
        linear-gradient(
            135deg,
            var(--color-primary),
            var(--color-primary-light)
        );
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    letter-spacing: 0.02em;
}

#header-main h1::after {
    content: '';
    display: block;
    width: 2.5rem;
    height: 3px;
    margin: 0.2rem auto 0;
    background-color: var(--color-accent);
    border-radius: 999px;
}

#header-main h2 {
    margin: 0.2rem 0 0;
    color: var(--color-text-light);
    font-family:
        var(--font-main-header-h2),
        'Courier New',
        monospace;
    font-weight: 400;
    font-size: 0.9rem;
}

/* ---------------------------------------------------------
   Main Navigation
   --------------------------------------------------------- */

#nav-main {
    position: relative;
    z-index: 10;
    max-width: 680px;
    margin: auto;
    display: flex;
    justify-content: center;
    margin-bottom: 0.4rem;
}

#container-provinces {
    width: 100%;
    position: relative;
}

#nav-main-button {
    width: 100%;
    min-height: 4.6rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    display: flex;
    align-items: center;
    color: var(--color-text-button);
    background:
        linear-gradient(
            135deg,
            var(--color-primary),
            var(--color-primary-light)
        );
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition:
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
}

#nav-main-button:hover {
    background:
        linear-gradient(
            135deg,
            var(--color-primary-dark),
            var(--color-primary)
        );
    box-shadow: var(--shadow-lg);
}

#nav-main-button:active {
    transform: translateY(1px);
}

#nav-main-button header {
    flex: 1;
}

#nav-main-button .svg-dropdown {
    flex: 0 0 auto;
}

/* ---------------------------------------------------------
   Province Header
   --------------------------------------------------------- */

#header-province-h3 {
    margin-top: 0.1rem;
    font-family: var(--font-header-h3), Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.2;
}

#header-rates-h3 {
    margin-top: 0.2rem;
    font-family: var(--font-header-h3), Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: #dce7ef;
}

#header-rates-h3 span {
    margin: 0 0.25rem;
}

#gst {
    color: #ffffff;
}

#pst {
    color: #ffffff;
}

#hst {
    color: #ffffff;
}

/* ---------------------------------------------------------
   SVG Icons
   --------------------------------------------------------- */

.svg-dropdown {
    width: 2.8rem;
    height: 2.8rem;
    fill: currentColor;
    transition: transform 0.2s ease;
}

#nav-main-button:hover .svg-dropdown {
    transform: translateY(2px);
}

.svg-x {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 1.5rem;
    height: 1.5rem;
    fill: var(--color-text-light);
    cursor: pointer;
    transition:
        fill 0.2s ease,
        transform 0.2s ease;
}

.svg-x:hover {
    fill: var(--color-accent);
    transform: scale(1.08);
}

#svg-info {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    margin-bottom: 0;
    fill: var(--color-primary-light);
    cursor: pointer;
    transition:
        fill 0.2s ease,
        transform 0.2s ease;
}

#svg-info:hover {
    fill: var(--color-accent);
    transform: scale(1.08);
}

/* ---------------------------------------------------------
   Dropdown Menus
   --------------------------------------------------------- */

.container {
    position: relative;
}

.drop-down-hidden {
    position: absolute;
    display: none;
}

.drop-down-visible {
    position: absolute;
    display: flex;
    flex-direction: column;
    z-index: 20;
    animation-name: fade-in;
    animation-duration: 0.2s;
    animation-timing-function: ease-out;
}


/* Province Dropdown */

#drop-down-provinces {
    width: 100%;
    margin-top: 0.4rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.nav-drop-button {
    width: 100%;
    padding: 0.4rem 0.8rem;
    color: var(--color-text);
    background-color: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family:
        var(--font-header-h3),
        Arial,
        sans-serif;
    font-size: 0.9rem;
    text-align: left;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.nav-drop-button:hover {
    color: var(--color-primary);
    background-color: #edf3f7;
}

.nav-drop-button:active {
    background-color: #e2eaf0;
}

/* ---------------------------------------------------------
   Main Content
   --------------------------------------------------------- */

main {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 680px;
    margin: auto;
}

/* ---------------------------------------------------------
   Main Sections
   --------------------------------------------------------- */

.main-section {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------
   Calculator
   --------------------------------------------------------- */

#calculator {
    width: 100%;
    margin-bottom: 0.4rem;
    padding: 0.8rem 1rem;
}

#calculator > p {
    margin: 0 0 0.7rem;
    color: var(--color-text-light);
    font-family:
        var(--font-header-h3),
        Arial,
        sans-serif;

    font-size: 0.95rem;
    text-align: center;
}


/* ---------------------------------------------------------
   Amount Input
   --------------------------------------------------------- */

#input-div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.8rem;
}

#amount {
    width: min(14rem, 75%);
    height: 3rem;
    padding: 0.35rem 0.75rem;
    color: var(--color-text);
    background-color: var(--color-surface-alt);
    border: 2px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 3px rgba(16, 38, 56, 0.06);
    text-align: right;
    font-size: 1.5rem;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

#amount:hover {
    border-color: var(--color-primary-light);
}

#amount:focus {
    background-color: var(--color-surface);
    border-color: var(--color-primary-light);
    outline: none;
    box-shadow:
        0 0 0 3px rgba(41, 75, 106, 0.12),
        inset 0 1px 3px rgba(16, 38, 56, 0.06);
}


/* ---------------------------------------------------------
   Calculator Buttons
   --------------------------------------------------------- */

#calculator nav {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

button {
    color: var(--color-text-button);
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-family:
        Verdana,
        Geneva,
        Tahoma,
        sans-serif;
    font-size: 1rem;
    font-weight: 600;
    transition:
        background-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

button:hover {
    background-color: var(--color-primary-light);
}

button:active {
    transform: translateY(1px);
}

/* Calculator Controls */

.calc-button {
    min-height: 2.7rem;
    margin: 0 0.2rem;
    padding: 0.4rem 0.6rem;
    box-shadow: var(--shadow-sm);
}

.calc-button:hover {
    box-shadow: var(--shadow-md);
}

/* ---------------------------------------------------------
   Tip Dropdown
   --------------------------------------------------------- */

#container-tip {
    position: relative;
}

#drop-down-tip {
    left: 50%;
    width: max-content;
    min-width: 100%;
    margin-top: 0.25rem;
    transform: translateX(-50%);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.tip-button {
    min-width: 4rem;
    padding: 0.4rem 0.6rem;
    color: var(--color-text);
    background-color: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.tip-button:hover {
    color: var(--color-primary);
    background-color: #edf3f7;
}

/* ---------------------------------------------------------
   Feedback / Results
   --------------------------------------------------------- */

#feedback {
    width: 100%;
    margin-top: 0;
    padding: 0.4rem 1rem;
    min-height: 20rem;
}

#feedback-table {
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 1rem;
}

#feedback-table td {
    padding: 0.55rem 0.35rem;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
}

#feedback-table td:empty {
    border-bottom: none;
}

#feedback-table td:first-child {
    color: var(--color-text-light);
}

#feedback-table td:last-child {
    color: var(--color-text);
    font-weight: 600;
}

#feedback-table tr:last-child td {
    border-bottom: none;
}


/* Totals */

#total-text,
#total-amount,
#tip-total-text,
#tip-total-amount {
    padding-top: 0.85rem;
}

#total-text,
#tip-total-text {
    color: var(--color-primary) !important;
    font-weight: 700;
}

#total-amount,
#tip-total-amount {
    color: var(--color-primary);

    font-size: 1.35rem;
    font-weight: 700;
}

.td-border {
    border-top: 2px solid var(--color-border-dark) !important;
    border-bottom: 3px double var(--color-primary) !important;
}

.td-no-border {
    border: none !important;
}

/* ---------------------------------------------------------
   Modals
   --------------------------------------------------------- */

.modal {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.2rem;
    width: 96%;
    max-height: calc(100vh - 1.2rem);
    padding: 0.6rem;
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    z-index: 100;
    animation-name: modal-in;
    animation-duration: 0.2s;
}

.modal p {
    margin-top: 1.6rem;
    color: var(--color-text-light);
    font-size: 0.95rem;
    line-height: 1.65;
}

.modal button {
    display: block;
    width: 5rem;
    margin: auto;
    padding: 0.55rem;
    background-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.modal button:hover {
    background-color: var(--color-primary-light);
}

/* Error modal */

#error {
    border-top-color: var(--color-accent);
}

#error-msg {
    color: var(--color-accent);
    font-weight: 600;
}


/* ---------------------------------------------------------
   Tablet
   --------------------------------------------------------- */

@media only screen and (min-width: 600px) {

    body {
        padding: 0 1.5rem 3rem;
    }

    #header-main {
        padding-top: 1.5rem;
    }

    #header-main h1 {
        font-size: 3.3rem;
    }

    #header-main h2 {
        font-size: 1.05rem;
    }

    #header-province-h3 {
        font-size: 1.9rem;
    }

    #header-rates-h3 {
        font-size: 1.1rem;
    }

    #calculator {
        padding: 1.4rem 1.5rem 1.3rem;
    }

    #feedback {
        padding: 1.4rem 1.5rem;
    }

    #feedback-table {
        font-size: 1.15rem;
    }

    .calc-button {
        min-height: 2.9rem;
        padding: 0.5rem 1rem;
    }
}

/* ---------------------------------------------------------
   Desktop
   --------------------------------------------------------- */

@media only screen and (min-width: 768px) {

    body {
        max-width: 760px;
    }

    #header-main h1 {
        font-size: 4rem;
    }

    #header-main h2 {
        font-size: 1.15rem;
    }

    #header-province-h3 {
        font-size: 2.2rem;
    }

    #header-rates-h3 {
        font-size: 1.3rem;
    }

    main {
        max-width: 680px;
    }

    #calculator > p {
        font-size: 1rem;
    }

    #amount {
        width: 15rem;
    }

    #feedback-table {
        font-size: 1.25rem;
    }

    .modal {
        width: 34rem;
    }
}

/* ---------------------------------------------------------
   Reduced Motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media only screen and (max-width: 419px) {
.calc-button {
    font-size: 0.8rem;
    padding: 0.45rem 0.65rem;
}
.nav-drop-button {
    font-size: 0.8rem;
}
.tip-button{
    font-size: 0.8rem;
}
#feedback {
    min-height: 16rem;
}
#feedback-table {
    font-size: 0.9rem;
}
}