/* General Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content Area */
main {
    background: white;
    border-radius: 15px;
    margin: 30px auto;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Section Styles */
.content-section {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.content-section:last-child {
    border-bottom: none;
}

.content-section h2 {
    color: #2a5298;
    font-size: 2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
    display: inline-block;
}

.content-section h3 {
    color: #1e3c72;
    font-size: 1.5em;
    margin: 25px 0 15px;
}

.content-section h4 {
    color: #444;
    font-size: 1.2em;
    margin: 20px 0 10px;
}

.content-section p {
    margin-bottom: 15px;
    text-align: justify;
}

.content-section ul {
    margin: 15px 0 15px 30px;
}

.content-section ul li {
    margin-bottom: 10px;
    line-height: 1.8;
}

/* Definition Box */
.definition-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 5px solid #2196f3;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.definition-box p {
    margin: 0;
    font-size: 1.05em;
}

/* Key Points Box */
.key-points {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #ddd;
}

.key-points h3 {
    color: #2a5298;
    margin-top: 0;
}

.key-points ul li {
    margin-bottom: 12px;
}

.key-points ul li strong {
    color: #1e3c72;
}

/* Format Display */
.format-display {
    background: #fafafa;
    padding: 25px;
    border-radius: 10px;
    margin: 25px 0;
    border: 2px solid #667eea;
}

/* Rules Box */
.rules-box {
    margin: 30px 0;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.rule-card {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #ff9800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.rule-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.rule-card h4 {
    color: #e65100;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.rule-card p {
    margin: 8px 0;
    text-align: left;
}

/* Example Box */
.example-box {
    background: #f5f5f5;
    padding: 25px;
    margin: 25px 0;
    border-radius: 10px;
    border: 2px solid #4caf50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.example-box h3 {
    color: #2e7d32;
    margin-top: 0;
}

/* Steps Box */
.steps-box {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 25px;
    margin: 25px 0;
    border-radius: 10px;
    border-left: 5px solid #4caf50;
}

.steps-box h3 {
    color: #2e7d32;
    margin-top: 0;
}

.steps-box ol {
    margin-left: 25px;
}

.steps-box ol li {
    margin-bottom: 12px;
    line-height: 1.8;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

/* Ledger Table */
.ledger-table {
    border: 2px solid #2a5298;
}

.ledger-table thead {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.ledger-table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #1e3c72;
}

.ledger-table .account-name {
    font-size: 1.2em;
    background: #1e3c72;
    padding: 15px;
}

.ledger-table .debit-side {
    background: #4caf50;
}

.ledger-table .credit-side {
    background: #f44336;
}

.ledger-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.ledger-table td:nth-child(3),
.ledger-table td:nth-child(6) {
    text-align: right;
    font-weight: 600;
}

.ledger-table tbody tr:hover {
    background: #f5f5f5;
}

.ledger-table .total-row {
    background: #e3f2fd;
    font-weight: bold;
}

.ledger-table .total-row td {
    border-top: 2px solid #2a5298;
    border-bottom: 3px double #2a5298;
}

.ledger-table .balance {
    color: #1565c0;
    font-weight: bold;
}

.ledger-table .credit-note {
    text-decoration: line-through;
}

/* Journal Table */
.journal-table {
    border: 2px solid #ff9800;
}

.journal-table thead {
    background: linear-gradient(135deg, #f57c00 0%, #ff9800 100%);
    color: white;
}

.journal-table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #f57c00;
}

.journal-table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.journal-table td:nth-child(3),
.journal-table td:nth-child(4),
.journal-table td:nth-child(5) {
    text-align: right;
}

.journal-table .narration {
    font-style: italic;
    color: #666;
    padding-left: 30px;
}

.journal-table .separator {
    height: 10px;
    background: #fff;
    border: none;
}

/* Subsidiary Table */
.subsidiary-table {
    border: 2px solid #9c27b0;
}

.subsidiary-table thead {
    background: linear-gradient(135deg, #7b1fa2 0%, #9c27b0 100%);
    color: white;
}

.subsidiary-table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #7b1fa2;
}

.subsidiary-table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.subsidiary-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.subsidiary-table .total-row {
    background: #f3e5f5;
    font-weight: bold;
    border-top: 2px solid #9c27b0;
}

/* Ledger Pair Display */
.ledger-pair {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 20px 0;
}

@media (min-width: 768px) {
    .ledger-pair {
        grid-template-columns: 1fr 1fr;
    }
}

/* Note Styles */
.note {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 5px;
    font-style: italic;
}

/* Practice Section */
.practice-section {
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    padding: 30px;
    border-radius: 15px;
    border: none;
}

.practice-intro {
    font-size: 1.1em;
    color: #1a237e;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 500;
}

/* Question Card */
.question-card {
    background: white;
    padding: 25px;
    margin: 25px 0;
    border-radius: 10px;
    border-left: 5px solid #3f51b5;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.question-card h3 {
    color: #1a237e;
    margin-bottom: 15px;
}

.question-text {
    margin: 15px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.question-text ul {
    margin-left: 25px;
}

.question-text ul li {
    margin-bottom: 8px;
}

/* Toggle Button */
.toggle-btn {
    background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    margin: 15px 0;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(63, 81, 181, 0.3);
}

.toggle-btn:hover {
    background: linear-gradient(135deg, #303f9f 0%, #3f51b5 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(63, 81, 181, 0.4);
}

.toggle-btn:active {
    transform: translateY(0);
}

/* Solution Box */
.solution-box {
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.solution-box h4 {
    color: #2e7d32;
    margin-bottom: 15px;
}

/* Summary Section */
.summary-section {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe9a3 100%);
    padding: 30px;
    border-radius: 15px;
    border: none;
}

.summary-box {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-box h3 {
    color: #f57c00;
    margin-bottom: 15px;
}

.summary-box ul li {
    margin-bottom: 12px;
    line-height: 1.8;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 30px;
}

footer p {
    margin: 5px 0;
}

.footer-note {
    font-style: italic;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    main {
        padding: 20px;
    }

    .content-section h2 {
        font-size: 1.6em;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.9em;
    }

    .ledger-table th,
    .ledger-table td {
        padding: 8px 5px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65398d 100%);
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    header,
    footer {
        background: #1e3c72;
        color: white;
    }

    .toggle-btn {
        display: none;
    }

    .solution-box {
        display: block !important;
        border: 1px solid #4caf50;
    }

    main {
        box-shadow: none;
    }
}