/* Reset and Base Styles */
.sgc-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sgc-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #ffffff;
    color: #111827;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden; /* Important: Yeh line add karo */
    width: 100%;
}

/* Title Container */
.sgc-title-container {
    background-color: #2CEC00;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sgc-main-title {
    font-size: 2rem;
    font-weight: 700;
    color: #000000 !important;  /* force black */
    margin-bottom: 8px;
    line-height: 1.3;
    word-wrap: break-word;
    padding: 0 5px;
}
.sgc-subtitle {
    font-size: 1rem;
    color: white;
    opacity: 0.9;
    line-height: 1.4;
    padding: 0 5px;
}

/* Main Container */
.sgc-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Cards */
.sgc-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.sgc-card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Input Section */
.sgc-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.sgc-input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    width: 100%;
}

.sgc-input-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.sgc-input-field label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.4;
}

.sgc-input-without-symbol {
    position: relative;
    width: 100%;
}

.sgc-input-without-symbol input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
    box-sizing: border-box;
    min-width: 0;
}

.sgc-input-without-symbol input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sgc-input-field input[type="date"],
.sgc-input-field select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background-color: white;
    transition: all 0.3s ease;
    box-sizing: border-box;
    min-width: 0;
}

.sgc-input-field input[type="date"]:focus,
.sgc-input-field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Advanced Section */
.sgc-advanced-toggle {
    text-align: center;
    margin-top: 10px;
    width: 100%;
}

.sgc-advanced-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sgc-advanced-btn:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

.sgc-advanced-section {
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}

.sgc-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    width: 100%;
}

.sgc-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
}

.sgc-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.sgc-checkbox span {
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.sgc-conditional-field {
    margin-left: 26px;
    margin-top: 8px;
    width: calc(100% - 26px);
}

/* Buttons */
.sgc-calculate-btn {
    text-align: center;
    margin-top: 15px;
    width: 100%;
}

.sgc-btn-green {
    background-color: #22c55e;
    color: white;
    border: none;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sgc-btn-green:hover {
    background-color: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Results Section */
.sgc-results-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.sgc-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.sgc-summary-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s ease;
    min-width: 0;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.sgc-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sgc-summary-card h4 {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 1.3;
    word-wrap: break-word;
}

.sgc-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    margin: 0;
}

.sgc-duration {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    margin: 0;
}

/* Progress Bar */
.sgc-progress-section {
    margin-bottom: 20px;
    width: 100%;
}

.sgc-progress-section h4 {
    margin-bottom: 10px;
    color: #374151;
    font-size: 1rem;
    line-height: 1.4;
}

.sgc-progress-bar {
    height: 16px;
    background-color: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
    width: 100%;
}

.sgc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #2563eb);
    border-radius: 8px;
    width: 0%;
    transition: width 1s ease-in-out;
    max-width: 100%;
}

.sgc-progress-text {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    flex-wrap: wrap;
    gap: 5px;
}

.sgc-progress-text span {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Charts */
.sgc-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.sgc-chart-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    min-width: 0;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.sgc-chart-card h4 {
    margin-bottom: 12px;
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.sgc-chart-card canvas {
    width: 100% !important;
    height: 220px !important;
    max-width: 100% !important;
    display: block !important;
}

/* Details Section */
.sgc-details-section {
    width: 100%;
    overflow: hidden;
}

.sgc-details-section h4 {
    margin-bottom: 15px;
    color: #374151;
    font-size: 1rem;
    line-height: 1.4;
}

.sgc-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.sgc-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
    min-width: 0;
}

.sgc-detail-item span:first-child {
    color: #6b7280;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.4;
    flex: 1;
    min-width: 120px;
}

.sgc-detail-item span:last-child {
    font-weight: 600;
    color: #111827;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: right;
    flex: 1;
    min-width: 80px;
}

/* Timeline */
.sgc-timeline-section {
    margin-top: 20px;
    width: 100%;
    overflow: hidden;
}

.sgc-timeline-section h4 {
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.4;
}

.sgc-timeline-container {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background-color: white;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.sgc-timeline-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
    table-layout: fixed;
}

.sgc-timeline-table th {
    background-color: #f9fafb;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    min-width: 70px;
    max-width: 100px;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.3;
    white-space: normal;
}

.sgc-timeline-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    min-width: 70px;
    max-width: 100px;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.3;
    white-space: normal;
}

.sgc-timeline-table tr:hover {
    background-color: #f8fafc;
}

/* Table scroll bar styling */
.sgc-timeline-container::-webkit-scrollbar {
    height: 6px;
}

.sgc-timeline-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sgc-timeline-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sgc-timeline-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Action Buttons */
.sgc-action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.sgc-btn-blue {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    flex: 1;
    min-width: 140px;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.sgc-btn-blue:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
}

.sgc-btn-gray {
    background-color: #6b7280;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    flex: 1;
    min-width: 140px;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.sgc-btn-gray:hover {
    background-color: #4b5563;
    transform: translateY(-2px);
}

/* Loading Overlay */
.sgc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    width: 100vw;
    height: 100vh;
}

.sgc-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e5e7eb;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: sgc-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes sgc-spin {
    to {
        transform: rotate(360deg);
    }
}

.sgc-loading-overlay p {
    font-size: 1rem;
    color: #374151;
    font-weight: 500;
}

/* Error Tooltip */
.sgc-input-error {
    border-color: #ef4444 !important;
    position: relative;
}

.sgc-tooltip {
    position: absolute;
    background-color: #ef4444;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 1000;
    margin-top: 4px;
    animation: fadeIn 0.3s ease;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Error Message */
.sgc-error-message {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    line-height: 1.4;
}

.sgc-error-close {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Success Message */
.sgc-success-message {
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sgc-wrapper {
        padding: 10px 8px;
        width: 100%;
        overflow-x: hidden;
    }
    
    .sgc-title-container {
        padding: 20px 15px;
        margin-bottom: 15px;
        border-radius: 10px;
    }
    
    .sgc-main-title {
        font-size: 1.6rem;
        margin-bottom: 6px;
        padding: 0;
    }
    
    .sgc-subtitle {
        font-size: 0.9rem;
        padding: 0;
    }
    
    .sgc-container {
        gap: 15px;
        width: 100%;
    }
    
    .sgc-card {
        padding: 15px 12px;
        border-radius: 8px;
        width: 100%;
        margin: 0;
    }
    
    .sgc-card-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .sgc-input-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .sgc-input-without-symbol input {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    .sgc-summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .sgc-summary-card {
        padding: 12px 8px;
        border-radius: 6px;
    }
    
    .sgc-summary-card h4 {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .sgc-amount, .sgc-duration {
        font-size: 1.3rem;
        line-height: 1.2;
    }
    
    .sgc-progress-section {
        margin-bottom: 15px;
    }
    
    .sgc-progress-section h4 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .sgc-progress-bar {
        height: 14px;
        margin-bottom: 6px;
    }
    
    .sgc-progress-text {
        font-size: 0.85rem;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .sgc-charts-container {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .sgc-chart-card {
        padding: 12px 10px;
    }
    
    .sgc-chart-card h4 {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .sgc-chart-card canvas {
        height: 200px !important;
    }
    
    .sgc-details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .sgc-detail-item {
        padding: 8px 0;
        font-size: 0.85rem;
    }
    
    .sgc-detail-item span:first-child {
        font-size: 0.85rem;
        min-width: 100px;
    }
    
    .sgc-detail-item span:last-child {
        font-size: 0.85rem;
        min-width: 70px;
    }
    
    .sgc-timeline-section {
        margin-top: 15px;
    }
    
    .sgc-timeline-section h4 {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    
    .sgc-timeline-container {
        border-radius: 6px;
    }
    
    .sgc-timeline-table {
        min-width: 600px;
        font-size: 0.8rem;
    }
    
    .sgc-timeline-table th,
    .sgc-timeline-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
        min-width: 60px;
        max-width: 90px;
        line-height: 1.2;
    }
    
    .sgc-action-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
    }
    
    .sgc-btn-blue,
    .sgc-btn-gray {
        width: 100%;
        min-width: 100%;
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .sgc-btn-green {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .sgc-input-field label {
        font-size: 0.85rem;
    }
    
    .sgc-checkbox span {
        font-size: 0.9rem;
    }
    
    .sgc-advanced-btn {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .sgc-wrapper {
        padding: 8px 6px;
    }
    
    .sgc-title-container {
        padding: 15px 10px;
        margin-bottom: 12px;
    }
    
    .sgc-main-title {
        font-size: 1.4rem;
    }
    
    .sgc-subtitle {
        font-size: 0.85rem;
    }
    
    .sgc-card {
        padding: 12px 10px;
    }
    
    .sgc-card-title {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .sgc-summary-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .sgc-summary-card {
        padding: 10px 8px;
    }
    
    .sgc-summary-card h4 {
        font-size: 0.75rem;
    }
    
    .sgc-amount, .sgc-duration {
        font-size: 1.2rem;
    }
    
    .sgc-chart-card canvas {
        height: 180px !important;
    }
    
    .sgc-timeline-table {
        min-width: 550px;
        font-size: 0.75rem;
    }
    
    .sgc-timeline-table th,
    .sgc-timeline-table td {
        padding: 6px 4px;
        font-size: 0.75rem;
        min-width: 55px;
        max-width: 80px;
    }
    
    .sgc-detail-item {
        font-size: 0.8rem;
    }
    
    .sgc-input-without-symbol input {
        padding: 9px 10px;
        font-size: 0.9rem;
    }
    
    .sgc-btn-green {
        padding: 11px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .sgc-wrapper {
        padding: 6px 4px;
    }
    
    .sgc-main-title {
        font-size: 1.2rem;
    }
    
    .sgc-subtitle {
        font-size: 0.8rem;
    }
    
    .sgc-card {
        padding: 10px 8px;
    }
    
    .sgc-summary-card h4 {
        font-size: 0.7rem;
    }
    
    .sgc-amount, .sgc-duration {
        font-size: 1.1rem;
    }
    
    .sgc-timeline-table {
        min-width: 500px;
    }
    
    .sgc-timeline-table th,
    .sgc-timeline-table td {
        padding: 5px 3px;
        font-size: 0.7rem;
    }
    
    .sgc-input-field label {
        font-size: 0.8rem;
    }
    
    .sgc-btn-green {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}

/* Print Styles */
@media print {
    .sgc-wrapper {
        padding: 0;
        max-width: 100%;
    }
    
    .sgc-action-buttons,
    .sgc-calculate-btn,
    .sgc-advanced-toggle,
    .sgc-loading-overlay {
        display: none !important;
    }
    
    .sgc-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        page-break-inside: avoid;
    }
    
    .sgc-timeline-container {
        overflow-x: visible !important;
        max-width: 100% !important;
    }
    
    .sgc-timeline-table {
        min-width: 100% !important;
        font-size: 8pt !important;
    }
    
    .sgc-chart-card canvas {
        height: 150px !important;
    }
}

/* Extra fix for very small screens */
@media (max-width: 320px) {
    .sgc-main-title {
        font-size: 1.1rem;
    }
    
    .sgc-card-title {
        font-size: 1rem;
    }
    
    .sgc-summary-card {
        padding: 8px 6px;
    }
    
    .sgc-amount, .sgc-duration {
        font-size: 1rem;
    }
    
    .sgc-timeline-table {
        min-width: 450px;
    }
}
/* Success Message */
.sgc-success-message {
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    line-height: 1.4;
}