:root {
    --ddm-blue: #004f9f;
    --ddm-blue-dark: #003a75;
    --ddm-light-blue: #f8fbff;
    --ddm-border: #e2e8f0;
    --ddm-text: #1e293b;
    --ddm-gray: #64748b;
    --grey: #eee; /* Match theme */
}

/* Page Layout */
.ddm-unit-converter-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr; /* 1/3 for products */
    gap: 40px;
    width: 100%;
    margin: 40px 0;
    align-items: start;
}

.ddm-uc-header {
    margin-bottom: 40px;
}

.ddm-uc-header h1 {
    font-size: 3rem;
    color: var(--ddm-blue);
    margin-bottom: 15px;
    border-bottom: 3px solid var(--secondary, #d15c04);
    display: inline-block;
    padding-bottom: 5px;
}

.ddm-uc-intro-top {
    font-size: 1.8rem;
    line-height: 1.6;
    color: var(--ddm-text);
    max-width: 900px;
}

/* Sidebar for Products */
.ddm-uc-products-section {
    padding: 40px 20px 20px; /* Space for absolute titles */
    display: none;
}

.ddm-uc-products-section h3 {
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 40px;
    color: var(--ddm-blue);
    border-bottom: 2px solid var(--ddm-blue);
    padding-bottom: 10px;
}

/* ADAPT THEME STYLES FOR SIDEBAR */
.ddm-uc-products-shop-style.product-container {
    display: block !important;
    padding-left: 0 !important; /* Remove theme's default left padding */
}

.ddm-uc-products-shop-style .product {
    width: 100% !important; /* Single column in sidebar */
    margin-right: 0 !important;
    margin-top: 4rem !important; /* Space for the absolute title above it */
    margin-bottom: 2rem !important;
}

/* Ensure absolute title is positioned relative to the product card */
.ddm-uc-products-shop-style .product .absolute-title {
    width: 90% !important;
    right: 5% !important;
}

/* Keep the theme's hover effect logic if possible, or force it visible if preferred */
/* The theme hides content-fields by default (opacity 0) */
/* If you want them always visible in sidebar: */
.ddm-uc-products-shop-style .product:hover .content-fields {
    opacity: 1 !important;
}

/* Fix for the centered absolute image in theme */
.ddm-uc-products-shop-style .product .content-img {
    min-height: 250px;
    background-color: var(--grey);
}

.ddm-uc-products-shop-style .product .content-img > img {
    max-height: 90% !important;
    width: auto !important;
    max-width: 90% !important;
}

/* Re-apply theme typography for the titles in sidebar */
.ddm-uc-products-shop-style .product .absolute-title .relative p.title {
    font-size: 1.4rem;
}

/* Calculation & Grid UI */
.ddm-uc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: end;
}

.ddm-uc-full-width { grid-column: 1 / -1; }

.ddm-uc-medium-section {
    background: var(--ddm-light-blue);
    padding: 30px;
    border-radius: 10px;
    margin: 30px 0;
    border: 1px solid #d0e1f0;
    display: none;
}

.ddm-uc-medium-section.visible {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.ddm-uc-medium-section h4 {
    grid-column: 1 / -1;
    margin: 0 0 15px 0;
    font-size: 0.9em;
    color: var(--ddm-blue);
    text-transform: uppercase;
}

.ddm-uc-result-card {
    background: var(--ddm-blue);
    color: #fff;
    padding: 50px 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 40px;
}

.ddm-uc-result-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

#ddm_uc_result { 
    font-size: 54px; 
    font-weight: 800; 
    line-height: 1;
}

#ddm_uc_copy {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ddm_uc_copy:hover { background: rgba(255,255,255,0.25); }

#ddm_uc_copy .dashicons { font-size: 18px; width: 18px; height: 18px; }

/* Overview Page */
.ddm-uc-overview-container {
    max-width: 1200px;
    margin: 40px auto;
}

.ddm-uc-subtitle {
    font-size: 1.4rem;
    color: var(--ddm-gray);
    margin-top: 5px;
    margin-bottom: 40px;
}

.ddm-uc-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 60px;
}

.ddm-uc-overview-card {
    background: #fff;
    border: 1px solid var(--ddm-border);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ddm-uc-overview-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,79,159,0.1);
    border-color: var(--ddm-blue);
}

.card-icon {
    width: 100px;
    height: 100px;
    background: var(--ddm-light-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    padding: 20px;
}

.card-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ddm-uc-overview-card h3 {
    margin: 0 0 15px 0;
    color: var(--ddm-blue-dark);
    font-size: 1.8rem;
}

.ddm-uc-overview-card p {
    color: var(--ddm-gray);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 25px;
    flex-grow: 1;
}

.ddm-uc-btn {
    display: inline-block;
    background: var(--ddm-blue);
    color: #fff !important;
    padding: 12px 25px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 600;
    transition: background 0.2s;
}

.ddm-uc-btn:hover {
    background: var(--ddm-blue-dark);
}

.ddm-uc-overview-footer {
    border-top: 1px solid var(--ddm-border);
    padding-top: 40px;
}

.ddm-uc-products-section-horizontal h3 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--ddm-blue);
}

.ddm-uc-products-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
}

@media (max-width: 900px) {
    .ddm-uc-card-grid { grid-template-columns: 1fr; }
}

/* Reference Table SEO */
.ddm-uc-reference-table {
    margin-bottom: 40px;
}

.ddm-uc-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--ddm-border);
    border-radius: 8px;
    overflow: hidden;
}

.ddm-uc-table th, .ddm-uc-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--ddm-border);
    font-size: 14px;
}

.ddm-uc-table th { background: #f8fafc; font-weight: 700; color: var(--ddm-blue-dark); }

#ddm_uc_result { font-size: 42px; font-weight: 800; }

.ddm-uc-steps {
    margin-bottom: 40px;
    background: #fafbfc;
    border: 1px solid var(--ddm-border);
    border-radius: 8px;
}

.ddm-uc-steps summary {
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
}

.uc-step-line {
    padding: 10px 15px;
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 8px;
    font-family: monospace;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .ddm-unit-converter-wrapper { grid-template-columns: 1fr; }
    .ddm-uc-products-shop-style.product-container {
        display: flex !important;
        flex-wrap: wrap !important;
        padding-left: calc(100% / 12 + 3rem) !important; /* Restore theme padding when wide */
    }
    .ddm-uc-products-shop-style .product {
        width: 30% !important;
        margin-right: 2rem !important;
    }
}

@media (max-width: 768px) {
    .ddm-uc-grid, .ddm-uc-medium-section.visible { grid-template-columns: 1fr; }
    .ddm-uc-products-shop-style.product-container {
        padding-left: 0 !important;
    }
    .ddm-uc-products-shop-style .product {
        width: 100% !important;
        margin-right: 0 !important;
    }
}
