/* style.css */

body {
    font-family: sans-serif;
    margin: 0 auto;
    background-color: #f4f4f4; /* Light mode background */
    color: #333; /* Light mode text */
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s; /* Smooth transition for dark mode */
    max-width: 1200px;
    padding: 0 20px;
    box-sizing: border-box;
}

body.dark-mode {
    background-color: #121212; /* Dark mode background */
    color: #eee; /* Dark mode text */
}

h1 {
    text-align: center;
    margin-bottom: 1rem;
    padding-top : 20px;
     /* No color specified here - handled by body and body.dark-mode */
}
.top-bar{
    display: flex;
    justify-content: space-between; /* Space out title and button */
    align-items: center; /* Vertically center items */
    padding: 0 20px; /* Add padding on the sides */

}

#dark-mode-toggle{
    padding: 8px 12px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#dark-mode-toggle:hover{
  background-color: #333;
}

h2 {
	text-align : center;
	margin-bottom: 1.5rem;
     /* No color specified here - handled by body and body.dark-mode */

}

h3 {
    margin-bottom: 0.5rem;
     /* No color specified here - handled by body and body.dark-mode */
}

/* --- Tabs --- */

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
     border-bottom: 1px solid #ddd; /* Add a subtle bottom border */
    background-color: #fff; /* Light mode tab background */
}
.dark-mode .tabs{
    background-color: #2c2c2c; /* Dark mode tab background */
    border-bottom-color : #555;
}

.tab-button {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: background-color 0.3s;
    font-size: 1rem;

}

.tab-button:hover {
    background-color: #ddd; /* Light mode hover */
}

.dark-mode .tab-button:hover {
    background-color: #555; /* Dark mode hover */
}

.tab-button.active {
     /* No color specified here - handled by body and body.dark-mode */
}

.dark-mode .tab-button.active {
      /* No color specified here - handled by body and body.dark-mode */
}
.tab-button.active {
    background-color: #2980b9; /* Blue for the active tab */
    color: white;
}

.dark-mode .tab-button.active{
  background-color: #4CAF50;
}



.tab-content {
    display: none;
    padding: 20px;
    border: 1px solid #ddd;  /* Light mode border */
    border-radius: 5px;
    background-color: white; /* Light mode background */
	box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.dark-mode .tab-content {
    border-color: #555; /* Dark mode border */
    background-color: #333; /* Dark mode background */
    box-shadow: 0 2px 5px rgba(255,255,255,0.1); /* Subtle shadow */

}


.tab-content.active {
    display: block;
}

/* --- Calculation Sections --- */

.calculation-section {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #ddd; /* Light mode border */
    border-radius: 8px;
    background-color: #fff; /* Light mode background */
     box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Subtle shadow */

}

.dark-mode .calculation-section {
    border-color: #555; /* Dark mode border */
    background-color: #444; /* Dark mode background */
}

/* --- Inputs and Select --- */

input[type="number"],
input[type="text"],
select {
    padding: 10px;
    margin: 5px 0;
    border: 1px solid #ccc; /* Light mode border */
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    background-color: #fff;
    color: #333;
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

.dark-mode input[type="number"],
.dark-mode input[type="text"],
.dark-mode select {
    border-color: #666; /* Dark mode border */
    background-color: #555; /* Dark mode background */
    color: #eee; /* Dark mode text */
}


input[type="text"] {
    background-color: #eee; /* Light mode readonly background */
    font-weight: bold;
    width: 80px;
}

.dark-mode input[type="text"] {
    background-color: #666; /* Dark mode readonly background */
}


select {
    width: auto;
}

/* --- General Calculator Styles --- */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f0f0f0; /* Light mode calculator background */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.dark-mode .calculator-grid {
    background-color: #333;
}

.calc-display {
    grid-column: 1 / -1;
    background-color: #fff; /* Light mode display background */
    padding: 15px;
    border-radius: 8px;
    text-align: right;
    margin-bottom: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.dark-mode .calc-display {
    background-color: #1e1e1e;
}

#calc-result {
    width: 100%;
    border: none;
    background-color: transparent;
    font-size: 2.5rem;
    font-family: 'Orbitron', sans-serif; /* Optional: for a digital look */
    text-align: right;
    color: #333; /* Light mode display text */
}

.dark-mode #calc-result {
    color: #eee; /* Dark mode display text */
}

.calc-btn {
    padding: 20px;
    font-size: 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.2s, box-shadow 0.2s;
}

.dark-mode .calc-btn {
    background-color: #555;
    color: #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.calc-btn:hover {
    background-color: #f9f9f9;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dark-mode .calc-btn:hover {
    background-color: #666;
}

.calc-btn:active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

.calc-btn.function {
    background-color: #e0e0e0; /* Light mode function buttons */
}

.dark-mode .calc-btn.function {
    background-color: #4a4a4a;
}

.calc-btn.operator {
    background-color: #f59e0b; /* Orange for operators */
    color: white;
}

.dark-mode .calc-btn.operator {
    background-color: #d97706;
}

.calc-btn.equals {
    background-color: #2563eb; /* Blue for equals */
    color: white;
    grid-column: 4 / 5;
    grid-row: 5 / 7;
}

.dark-mode .calc-btn.equals {
    background-color: #1d4ed8;
}

.calc-btn.zero {
    grid-column: 1 / 3;
}


/* --- Stopwatch & Timer Styles --- */
.stopwatch-timer-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.st-tab-button {
    padding: 10px 20px;
    font-size: 1.1rem;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: background-color 0.3s;
    border-radius: 5px;
    margin: 0 5px;
}

.dark-mode .st-tab-button {
    background-color: #444;
    border-color: #666;
}

.st-tab-button:hover {
    background-color: #e9e9e9;
}

.dark-mode .st-tab-button:hover {
    background-color: #555;
}

.st-tab-button.active {
    background-color: #2980b9;
    color: white;
    border-color: #2980b9;
}

.dark-mode .st-tab-button.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.st-tab-content {
    display: none;
    text-align: center;
}

.st-tab-content.active {
    display: block;
}

.time-display {
    font-size: 4rem;
    font-family: 'Orbitron', sans-serif;
    margin: 20px 0;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
}

.dark-mode .time-display {
    background-color: #1e1e1e;
    color: #eee;
}

.st-controls button {
    padding: 12px 25px;
    font-size: 1.2rem;
    margin: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 120px;
}

#sw-start, #timer-start {
    background-color: #28a745; /* Green */
    color: white;
}

#sw-stop, #timer-pause {
    background-color: #dc3545; /* Red */
    color: white;
}

#sw-reset, #timer-reset {
    background-color: #6c757d; /* Gray */
    color: white;
}

.timer-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.timer-inputs input {
    width: 80px;
    font-size: 2rem;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 0 5px;
}

.timer-inputs span {
    font-size: 2rem;
    font-weight: bold;
}


/* --- Responsive Design (Media Queries) --- */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
        align-items: stretch;
    }

     .tab-button {
        width: 100%;
        text-align: center;
        padding : 10px 10px;
    }
    .calculation-section{
        padding: 15px;

    }
    input[type="number"],
    input[type="text"],
    select{
        width : auto; /*auto width on mobile*/
    }
}

@media (max-width: 480px) {
	h1{
		font-size : 1.5em;
	}
	h2{
		font-size : 1.2em;
	}
    .calculator-grid {
        max-width: 100%;
        padding: 15px;
    }
    .calc-btn {
        padding: 15px;
        font-size: 1.2rem;
    }
    #calc-result {
        font-size: 2rem;
    }
}
