/* ---------------------------------------------------------
   GLOBAL
--------------------------------------------------------- */
body {
    margin: 0;
    padding: 0;
    background-image: url('graphingpaper.jpeg');
    font-family: 'Open Sans';
}

a {
    color: inherit;
    text-decoration: none;
}

h1 {
    font-size: 16pt;
}

div {
    font-size: 10pt;
}

/* ---------------------------------------------------------
   MAIN BODY WRAPPER
--------------------------------------------------------- */
div.mainbody {
    margin: auto;
    background-color: white;
    max-width: 1600px;
    width: 100%;
    overflow: visible; /* FIX: prevents dropdown clipping */
    box-shadow: -5px 5px 10px rgba(0,0,0,0.2);
}

div.bodywidth {
    padding: 10px;
}

/* ---------------------------------------------------------
   HEADER IMAGE
--------------------------------------------------------- */
div.pagetop {
    height: 60px;
    background-image: url('header.jpg');
    background-position: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

/* Logo spacing */
.header-logo {
    padding: 10px 0;
    text-align: center;
}

/* ---------------------------------------------------------
   FLEX MENU BAR
--------------------------------------------------------- */
#menubar {
    background-color: #01354b;
    color: white;
    padding: 10px;
    min-height: 50px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start; /* FIX: stable alignment */
    gap: 20px;
    position: relative;
    box-shadow: -5px 5px 10px rgba(0,0,0,0.2);
    overflow: visible;
}

.menu-items {
    display: flex; /* FIX: ensures desktop always shows menu */
    align-items: center;
    gap: 20px;
}

/* MENU ITEM */
.menuhead {
    padding: 13px;
    border-radius: 5px;
    cursor: pointer;
    position: relative; /* FIX: anchors dropdown correctly */
    display: flex;
    align-items: center;
}

.menuhead:hover {
    background-color: #62b4d6;
}

/* ACTIVE MENU */
.active {
    padding: 13px;
    background-color: #478aa6;
    border-radius: 5px;
}

/* SUBMENU (dropdown) */
.menuitemsbox {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #62b4d6;
    padding: 10px;
    min-width: 200px;          /* FIX: stable width */
    width: max-content;        /* FIX: prevents cramped text */
    border-radius: 0 10px 10px 10px;
    box-shadow: -5px 5px 10px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 100;
}

.menuitemsbox p {
    margin: 5px 0;
}

.menuitemsbox p:hover {
    color: beige;
}

/* SHOW SUBMENU ON HOVER (desktop) */
.menuhead:hover .menuitemsbox {
    display: flex;
}

/* ---------------------------------------------------------
   HAMBURGER (mobile)
--------------------------------------------------------- */
.hamburger {
    display: none;
    font-size: 28px;
    padding: 10px;
    cursor: pointer;
    margin-right: auto; /* FIX: keeps hamburger left-aligned */
}

/* ---------------------------------------------------------
   MOBILE MODE
--------------------------------------------------------- */

@media only screen and (max-width: 768px) {
    #NewsHead .news-text p {
        display: none !important;
    }
}

@media (max-width: 768px) {

    #menubar {
        flex-direction: column;
        align-items: flex-start;
    }

    .hamburger {
        display: block;
    }

    .menu-items {
        display: none; /* hidden until hamburger opens */
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    #menubar.open .menu-items {
        display: flex;
    }

    .menuhead {
        width: 100%;
    }

    .menuitemsbox {
        position: static;
        border-radius: 0;
        box-shadow: none;
        padding-left: 15px; /* FIX: better spacing */
        padding-right: 10px;
        display: none;
    }

    .menuhead.open .menuitemsbox {
        display: flex;
    }

    .menuitemsbox p {
        margin: 10px 0; /* FIX: readable spacing */
    }
    
    
    
}
tr.row0 { background-color: #ffffff; }
tr.row1 { background-color: #f3f3f3; }

@media (max-width: 768px) {

    /* Kill horizontal scroll */
    #stocklist {
        min-width: 0 !important;
        width: 100% !important;
    }

    .table-wrapper {
        overflow-x: hidden !important;
    }
}



/* ---------------------------------------------------------
   DESKTOP MODE RESET (prevents mobile state leaking)
--------------------------------------------------------- */
@media (min-width: 769px) {
    .menu-items {
        display: flex !important;
    }
    .menuhead.open .menuitemsbox {
        display: none;
    }
}

#stockFilterBar form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px; /* spacing between controls */
    flex-wrap: nowrap; /* force one line */
}

#stockFilterBar select,
#stockFilterBar input[type="text"],
#stockFilterBar span,
#stockFilterBar .button {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

#stockFilterBar .button {
    cursor: pointer;
    padding: 4px 10px;
    background: #01354b;
    color: white;
    border-radius: 4px;
}

.Gain {
    color: green;
}
.Loss {
    color: red;
}


/* ---------------------------------------------------------
   FOOTER BAR
--------------------------------------------------------- */
#footerbar {
    background-color: #01354b;
    color: white;
    padding: 10px;
    text-align: left;
    box-shadow: -5px -5px 10px rgba(0,0,0,0.2);
}

#pager {
    margin-top: 20px;
    text-align: center;
    font-size: 14pt;
}

#pager .page-link {
    display: inline-block;
    padding: 6px 10px;
    margin: 0 4px;
    cursor: pointer;
    color: #1a0dab;
}

#pager .page-link:hover {
    text-decoration: underline;
}

#pager .active {
    font-weight: bold;
    color: #000;
    text-decoration: none;
    cursor: default;
}

/* ---------------------------------------------
   TABLE
--------------------------------------------- */
#stocklist {
    border-collapse: collapse;
    width: 100%;
    font-family: 'Open Sans';
}

#stocklist th {
    background-color: #01354b;
    color: white;
    padding: 10px;
    cursor: pointer;
    font-size: 10pt;
}

#stocklist td {
    padding: 10px;
    font-size: 10pt;
}


#stocklist tr:hover {
    background-color: #e0f0f8;
}

/*CLAMP BOX*/
/* Container for clamped text + more link */
/* ---------------------------------------------------------
   CLAMP FIX ? MATCHES INLINE SPECIFICITY
--------------------------------------------------------- */

.clamp-box {
  position: relative;
  width: 100%;
}

/* Clamp text */
#NewsBottom p.clamped {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  white-space: normal !important;
}

/* Position the more link ON the last line */
.more-link {
  position: absolute;
  right: 0;
  bottom: 0;
  background: white; /* prevents overlap artifacts */
  padding-left: 14px;
  line-height: 1.5;
}
#NewsBottom p.clamped {
    -webkit-line-clamp: 5 !important;
  }
