* {
    box-sizing: border-box;
    padding: 1;
    margin: 1;
    color: #202223;
    font-family: 'Roboto', 'Open Sans', 'Helvetica Neue', sans-serif;
    text-decoration: none;
    list-style: none;
    line-height: 1.5em;
}

.mycontainer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    padding: 0 15px;
    margin: 0 auto;
    overflow-x: hidden;
}

.stock {
    margin: 10px 0;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.close {
    text-align: right;
    margin-bottom: 5px;
}

.close small {
    cursor: pointer;
    color: #ff4444;
    font-weight: bold;
}

.close small:hover {
    color: #cc0000;
}

.addnew {
    margin: 15px 0;
    text-align: center;
}

#addnew {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#addnew:hover {
    background: #45a049;
}

.calculate {
    margin: 15px 0;
    text-align: center;
}

#calculate {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-transform: uppercase;
}

#calculate:hover {
    background: #1976D2;
}

.current-price {
    margin: 15px 0;
    text-align: center;
}

.current-price input {
    margin-left: 10px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#stock3, #stock4, #stock5, #stock6, #stock7, #stock8, #stock9, #stock10, #resultbox {
    display: none;
}

.addnew {
    max-width: 700px;
    display: flex;
    justify-content: flex-end;
    margin: 10px auto;
    padding: 5px 10px;

}



.addnew button {
    text-decoration: underline;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: #ffffff;
    background-color: #008080;
    padding: 8px 10px;
                font-size: 15px;

}


.close {
    opacity: 0.7;
    cursor: pointer;
    display: flex;
    justify-content: flex-end;
}

.close:hover {
    opacity: 1;
    text-decoration: underline;
}

.result {
    /* text-align: center; */
    /* border: 1px solid; */
    border-radius: 5px;
    width: fit-content;
    margin: auto;
    padding: 5px;

}

/* Enhanced Result Styles */
.resultdata {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding: 5px 10px;
    margin: 5px 0;
}

#avgPrice, #totalInvestment, #totalShares {
    color: #2196F3;
}

#profitLoss.profit {
    color: #4CAF50;
}

#profitLoss.loss {
    color: #F44336;
}

#profitLossPercentage.profit {
    color: #4CAF50;
}

#profitLossPercentage.loss {
    color: #F44336;
}

.transaction-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.transaction-table {
    width: 100%;
    min-width: 500px; 
    border-collapse: collapse;
    background: white;
}

.transaction-table th,
.transaction-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap; 
}

.transaction-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #343a40;
}

.transaction-table td {
    font-size: 14px;
}

.transaction-table th:nth-child(1),
.transaction-table td:nth-child(1) {
    width: 15%;  /* Stock Name */
}

.transaction-table th:nth-child(2),
.transaction-table td:nth-child(2) {
    width: 15%;  /* Quantity */
}

.transaction-table th:nth-child(3),
.transaction-table td:nth-child(3) {
    width: 15%;  /* Price */
}

.transaction-table th:nth-child(4),
.transaction-table td:nth-child(4) {
    width: 15%;  /* Total */
}

.transaction-table th:nth-child(5),
.transaction-table td:nth-child(5) {
    width: 20%;  /* Average */
}

.transaction-table th:nth-child(6),
.transaction-table td:nth-child(6) {
    width: 20%;  /* Total Investment */
}

.transaction-table tbody tr:hover {
    background-color: #f8f9fa;
}

.transaction-table {
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.transaction-table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    padding: 12px 15px;
}

.transaction-table td {
    padding: 12px 15px;
    color: #2c3e50;
}

.transaction-table tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

.color {
    color: #45B6B7;
}

.underline {
    text-decoration: underline;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 18px;
}

a {
    color: #005eff;
    cursor: pointer;
    word-wrap: break-word;
}

a:hover {
    text-decoration: underline;
}

p {
    margin: 10px 0px;
}

.center {
    text-align: center;
    /* justify-content: center; */
    /* align-items: center; */
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.logo a:hover {
    text-decoration: none;
    cursor: pointer;
}

.logo h1 {
    /* color: #202223; */
    font-family: 'Times New Roman', Times, serif;
    /* color: #ffffff; */
    color: #FFFFFF;
}

.logo img {
    display: flex;
    justify-content: center;
    align-items: center;
}

.strong {
    font-weight: 700;
}

.small {
    font-size: 14px;
}

section a {
    text-decoration: underline;
}

.menu a {
    padding: 0px 15px;
    color: #202223;
    cursor: pointer;
     color: #ffffff; 
}

.menu-icon {
    display: none;
}

td {
    padding: 10px 20px;
    border-bottom: 1px solid #aaaaaa;
    word-break: break-word;
}

.calculate {
    display: flex;
    justify-content: center;
    align-items: center;
}

.calculate button {
        background-color: rgb(0, 128, 128);
    color: rgb(255, 255, 255);
    font-size: 1.3rem;
    padding: 10px 80px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(76, 97, 162, 0.20), 0 6px 6px rgba(76, 97, 162, 0.20);
}

header, .calculation, .content,
footer {

    padding: 0 10%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    background-color: rgb(0, 128, 128);    
    /* background-color: #ffffff; */
    /* background-color: #202223; */
    /* background-color: #F7F7F7; */
}

.calculator{
    width: 100%;
    max-width: 100%;
    padding: 15px;
}

.calculator {
    border: 1px solid #c4c4c4;
    border-radius: 5px;
    padding: 5px;
    box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
    /* background-color: #f5f5f5; */
}

.calculator h2 {
    text-align: center;
}





.bottom {
    position: sticky;
    bottom: -10px;
    margin: 0 auto;
    /* background-color: rebeccapurple; */

}

.input-section {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.stock-input {
    margin-bottom: 15px;
    position: relative;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.close-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background: #cc0000;
}

.button-container {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#printSummary, #clearAll {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

#printSummary {
    background-color: #4CAF50;
    color: white;
}

#clearAll {
    background-color: #f44336;
    color: white;
}

#printSummary:hover {
    background-color: #45a049;
}

#clearAll:hover {
    background-color: #da190b;
}

@media (max-width: 768px) {
    .button-container {
        flex-direction: row;
        align-items: center;
    }
    
    #printSummary, #clearAll {
        padding: 8px 16px;
        font-size: 14px;
    }
}

.print-button {
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    color: white;
    background-color: #28a745;
    transition: background-color 0.2s;
}

.print-button:hover {
    background-color: #218838;
}

/* Mobile responsiveness for button */
@media screen and (max-width: 768px) {
    .print-button {
        width: 100%;
    }
}

/* Make inputs more touch-friendly on mobile */
@media screen and (max-width: 768px) {
    input[type="number"],
    input[type="text"] {
        height: 40px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 8px;
    }

    button {
        min-height: 44px; /* Better touch targets */
        padding: 10px 15px;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    .input-group input,
    .input-group button {
        width: 100%;
    }
}

/* Improve table responsiveness */
@media screen and (max-width: 480px) {
    table {
        font-size: 0.9em;
    }

    td, th {
        padding: 8px 5px;
    }

    .resultdata {
        font-size: 0.9em;
    }
}

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

    header {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .logo h1 {
        margin-left: 32px;
    }

    .menu-icon {
        position: absolute;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        top: 0;
        left: 0;
        height: 64px;
        width: 64px;
    }

    .menu-icon span {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 24px;
        height: 2px;
        margin-bottom: 2px;
        margin-top: 2px;
        background-color: #202223;
        /* background: #ffffff; */
    }

    .mobile-menu {
        position: absolute;
        display: none;
        justify-content: flex-start;
        align-items: flex-start;
        flex-direction: column;
        z-index: 1;
        left: 0;
        right: 0;
        top: 70px;
        padding: 10px;
        background-color: #202223;
    }

    .mobile-menu a {
        padding: 10px;
        color: #ffffff;
    }

    td {
        padding: 5px 0px;
    }

    header, .calculation, footer {
        padding: 0 10px;
    }

     .computer {
        display: none;
    }

  

    .mycontainer {
        display: flex;
        justify-content: space-between;
        flex-direction: column;
    }

    .calculator {
        width: 100%;
    }

    .content {
        padding: 20px 10px;
    }



    .footer-container {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }

    .footer-text {
        width: 100%;
        text-align: center;
    }

    #top {
        bottom: 50px;
        right: 30px;
    }

    .graph-container {
        flex-direction: column;
    }
    
    .graph-item {
        width: 100%;
    }
}

/* Result Section Styles */
.result {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 24px;
    margin: 20px 0;
    width: 100%;
}

.result h3 {
    color: #343a40;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2rem;
}

.result hr {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 15px 0;
}

.result-grid {
    display: grid;
    gap: 20px;
}

@media screen and (min-width: 769px) {
    .result-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease;
}

.result-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resultdata {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

/* Profit/Loss colors */
.resultdata.positive {
    color: #10b981 !important;
}

.resultdata.negative {
    color: #ef4444 !important;
}

/* Desktop styles */
@media screen and (min-width: 769px) {
    .result-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    #profitLossCards {
        grid-column: span 2;
        grid-template-columns: repeat(2, 1fr);
    }

    .result-card {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .result-label {
        font-size: 14px;
        color: #64748b;
        margin-bottom: 8px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .result-grid {
        grid-template-columns: 1fr;
    }

    #profitLossCards {
        grid-template-columns: 1fr;
    }
}

/* Print styles for results */
@media print {
    /* Hide everything */
    body * {
        visibility: hidden !important;
        display: none !important;
    }
    
    /* Show only transaction container */
    .transaction-container {
        display: block !important;
        visibility: visible !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        background: white !important;
        padding: 20px !important;
    }

    /* Make all elements inside transaction container visible */
    .transaction-container * {
        visibility: visible !important;
        display: block !important;
    }

    /* Table specific styles */
    .transaction-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-bottom: 20px !important;
    }

    .transaction-table th,
    .transaction-table td {
        border: 1px solid black !important;
        padding: 8px !important;
        text-align: center !important;
    }

    /* Hide buttons when printing */
    .button-container {
        display: none !important;
    }

    /* Set page margins */
    @page {
        margin: 0.5cm !important;
    }
}

@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
    }
    
    .input-group input {
        width: 100%;
    }
    
    .close-btn {
        position: absolute;
        right: 0;
        top: 0;
    }
}

input, select {
    height: 35px;
    width: 180px;
    margin: 8px;
    padding: 8px;
    text-align: center;
    border: 1px solid #202223;
    background-color: #ffffff;
    border-radius: 5px;
    font-size: 16px;
}

input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

footer {
    background-color: #008080;
    padding: 20px 0;
    color: #ffffff;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.copyright {
    text-align: center;
    color: #ffffff;
    margin-bottom: 15px;
}

.langs {
    text-align: center;
    margin: 15px 0;
}

.langs a {
    color: #ffffff;
    text-decoration: none;
    margin: 0 5px;
    font-size: 14px;
}

.langs span {
    color: #ffffff;
    margin: 0 5px;
}

.langs a:hover {
    text-decoration: underline;
}

#top {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 50px;
    cursor: pointer;
    z-index: 100;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.stock table {
    width: 100%;
    max-width: 100%;
}

input[type="number"],
input[type="text"] {
    width: 100%;
    max-width: 100%;
}

/* Mobile specific fixes */
@media screen and (max-width: 768px) {
    .calculator {
        padding: 10px;
    }

    .stock {
        width: 100%;
        padding: 10px;
    }

    table td {
        padding: 5px;
    }

    input[type="number"],
    input[type="text"] {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 8px;
    }

    .result {
        width: 100%;
        margin: 10px 0;
        padding: 15px;
    }

    .result-grid {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .transaction-container {
        width: 100%;
        margin: 10px 0;
        padding: 10px;
    }

    .chart-container {
        width: 100%;
        margin: 10px 0;
        padding: 10px;
    }
}

/* Extra small devices */
@media screen and (max-width: 480px) {
    .mycontainer {
        padding: 0 10px;
    }

    .calculator {
        padding: 5px;
    }

    .stock {
        padding: 5px;
    }

    table td {
        padding: 3px;
    }

    .result,
    .transaction-container,
    .chart-container {
        padding: 8px;
    }
}

/* Desktop styles (screens larger than 768px) */
@media screen and (min-width: 769px) {
    .mycontainer {
        display: flex;
        flex-direction: row;
        gap: 30px;
        padding: 20px;
        max-width: 1400px;
        margin: 0 auto;
    }

    .calculator {
        flex: 0 0 400px;
        position: sticky;
        top: 20px;
        height: fit-content;
        align-self: flex-start;
        margin-bottom: 20px;
    }

    .results-section {
        flex: 1;
        min-width: 0; /* Prevents flex item from overflowing */
    }

    .additional-results {
        margin-bottom: 30px;
    }

    .result-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }

    .transaction-container {
        margin: 30px 0;
        overflow-x: auto;
    }

    .chart-container {
        margin: 30px 0;
    }

    .stock table {
        margin: 0 auto;
        width: 100%;
    }

    input[type="number"],
    input[type="text"] {
        width: 150px;
    }

    .calculate {
        margin-top: 20px;
    }

    .calculate button {
        width: auto;
        min-width: 200px;
    }

    .fixed-print-container {
        margin-top: 20px;
    }
}

/* Ensure proper spacing between sections */
.additional-results,
.transaction-container,
.chart-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

/* Keep the mobile layout for screens <= 768px */
@media screen and (max-width: 768px) {
    .mycontainer {
        flex-direction: column;
        padding: 10px;
    }

    .calculator,
    .results-section {
        width: 100%;
    }

    .result-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Result cards layout */
.additional-results {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-grid {
    display: grid;
    gap: 20px;
}

.result-card {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease;
}

.result-card:hover {
    transform: translateY(-2px);
}

.result-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resultdata {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

/* Profit/Loss colors */
.resultdata.positive {
    color: #10b981 !important;
}

.resultdata.negative {
    color: #ef4444 !important;
}

/* Desktop styles */
@media screen and (min-width: 769px) {
    .result-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    #profitLossCards {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin-top: 10px;
    }

    /* Transaction table styles */
    .transaction-container {
        margin-top: 30px;
        overflow-x: auto;
        background: white;
        border-radius: 8px;
        padding: 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .transaction-table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    .transaction-table th {
        background: #f8fafc;
        padding: 12px;
        text-align: left;
        font-weight: 600;
        color: #64748b;
        border-bottom: 2px solid #e2e8f0;
    }

    .transaction-table td {
        padding: 12px;
        border-bottom: 1px solid #e2e8f0;
    }

    .transaction-table tr:last-child td {
        border-bottom: none;
    }
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .result-grid {
        grid-template-columns: 1fr;
    }

    #profitLossCards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .resultdata {
        font-size: 18px;
    }

    .transaction-container {
        margin: 20px 0;
        padding: 15px;
        overflow-x: auto;
    }

    .transaction-table {
        min-width: 100%;
    }

    .transaction-table th,
    .transaction-table td {
        padding: 10px;
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    /* Reset everything */
    * {
        margin: 0 !important;
        padding: 0 !important;
        visibility: hidden;
        background: none !important;
        box-shadow: none !important;
    }

    /* Hide absolutely everything except transaction table */
    body > *:not(.mycontainer),
    .mycontainer > *:not(.results-section),
    .results-section > *:not(.transaction-container) {
        display: none !important;
    }

    /* Show only transaction container */
    .transaction-container,
    .transaction-container * {
        visibility: visible;
    }

    .transaction-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
    }

    /* Hide buttons */
    .button-container,
    #printSummary,
    #clearAll {
        display: none !important;
    }

    /* Table styles */
    .transaction-table {
        width: 100%;
        border-collapse: collapse;
        page-break-inside: avoid;
    }

    .transaction-table th,
    .transaction-table td {
        border: 1px solid #000;
        padding: 5px !important;
        text-align: center;
        font-size: 12px;
    }

    /* Force single page */
    @page {
        size: auto;
        margin: 1cm;
    }

    /* Hide all scripts and styles */
    script, style, link {
        display: none !important;
    }
}

.transaction-container {
    overflow-x: auto;
    margin: 20px 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 300px;
}

.transaction-table th,
.transaction-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
}

.transaction-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.transaction-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.transaction-table tr:hover {
    background-color: #f5f5f5;
}

@media screen and (max-width: 600px) {
    .transaction-container {
        margin: 10px -15px;
        border-radius: 0;
    }

    .transaction-table {
        font-size: 14px;
    }

    .transaction-table th,
    .transaction-table td {
        padding: 8px;
    }

    @media screen and (max-width: 350px) {
        .transaction-table {
            font-size: 12px;
        }

        .transaction-table th,
        .transaction-table td {
            padding: 6px;
        }
    }
}

@media screen and (max-width: 768px) {
    .transaction-container {
        margin: 10px -15px;
        width: calc(100% + 30px); /* Compensate for negative margins */
        border-radius: 0;
    }

    .transaction-table {
        font-size: 14px;
    }

    .transaction-table th,
    .transaction-table td {
        padding: 8px;
    }
}

@media screen and (max-width: 350px) {
    .transaction-table {
        font-size: 12px;
    }

    .transaction-table th,
    .transaction-table td {
        padding: 6px;
    }
}
