/* Plugin Styles */

/* ==========================================================================
   Theme Override: Force full-width panel layout on any theme
   ========================================================================== */
body#error-page,
body.page,
body {
    max-width: none !important;
    width: 100% !important;
}

body#error-page {
    margin: 0 auto !important;
    padding: 0 !important;
    background: #F1F5F9 !important;
}

body.page-template-page-panel .site-main,
body.page-template-page-panel .site-content,
body.page-template-page-panel .entry-content,
body.page-template-page-panel .post-content,
body.page-template-page-panel .content-area,
body.page-template-page-panel .ast-container,
body.page-template-page-panel article,
body.page-template-page-panel .page-content,
body.page-template-page-panel main,
body.page-template-page-panel #primary,
body.page-template-page-panel #content,
body.page-template-page-panel .container,
body.page-template-page-panel .wp-block-post-content {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Remove theme page padding/margin when panel is active */
body .dashboard-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.kd-form-wrapper {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    max-width: 600px;
    margin: 2rem auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #475569;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    color: #1E293B;
    background-color: #F8FAFC;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563EB;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 1rem;
    background: #2563EB;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #1D4ED8;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
    text-align: center;
}

.btn * {
    pointer-events: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: #2563EB;
    color: white !important;
}

.btn-primary:hover {
    background: #1D4ED8;
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    border-color: #CBD5E1;
    color: #475569 !important;
}

.btn-outline:hover {
    background: #F8FAFC;
    border-color: #94A3B8;
    color: #1E293B !important;
}

.btn-success {
    background: #10B981;
    color: white !important;
}

/* Re-iterating Dashboard Styles here so they load with plugin explicitly if theme doesn't have them */
.dashboard-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 85vh;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.panel-sidebar {
    background: #0F172A;
    color: white;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.panel-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94A3B8;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
}

.panel-nav a:hover,
.panel-nav a.active {
    background: #1E293B;
    color: white;
}

.panel-nav a span {
    font-size: 1.1rem;
}

.logout-link {
    margin-top: auto;
    color: #F87171 !important;
}

.logout-link:hover {
    background: rgba(248, 113, 113, 0.1) !important;
}

.user-mini-profile {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    background: #3B82F6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: #94A3B8;
}

/* Content Area */
.panel-content {
    padding: 3rem;
    background: #F1F5F9;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.panel-header h1 {
    font-size: 1.75rem;
    color: #1E293B;
    font-weight: 700;
    margin: 0;
}

.panel-header .subtitle {
    color: #64748B;
    margin: 0.25rem 0 0 0;
    font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-orange {
    background: #FFF7ED;
    color: #EA580C;
}

.icon-green {
    background: #ECFDF5;
    color: #059669;
}

.icon-blue {
    background: #EFF6FF;
    color: #2563EB;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748B;
    margin-top: 0.25rem;
}

.section-title {
    font-size: 1.2rem;
    color: #334155;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Proposal List */
.proposal-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.proposal-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.proposal-card:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.proposal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.proposal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1E293B;
    margin: 0 0 0.5rem 0;
}

.proposal-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.meta-date {
    color: #64748B;
}

.meta-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-pending {
    background: #FFF7ED;
    color: #C2410C;
}

.status-processing {
    background: #EFF6FF;
    color: #1D4ED8;
}

.status-completed {
    background: #ECFDF5;
    color: #047857;
}

.proposal-right {
    text-align: right;
}

.proposal-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 0.5rem;
}

/* Progress Bar Container */
.progress-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #F1F5F9;
}

/* Hide sidebar toggle on desktop */
.sidebar-toggle-btn {
    display: none !important;
}

@media (max-width: 900px) {
    .dashboard-wrapper {
        grid-template-columns: 1fr !important;
        display: block !important;
        min-height: auto;
    }

    .panel-sidebar {
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        position: relative;
        width: 100% !important;
    }

    .sidebar-brand {
        margin: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.75rem;
    }

    /* Mobile sidebar toggle button */
    .sidebar-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
        border: none;
        color: white;
        font-size: 0.85rem;
        padding: 10px 16px;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
        letter-spacing: 0.3px;
        transition: all 0.25s ease;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    }

    .sidebar-toggle-btn:hover {
        background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
        transform: translateY(-1px);
    }

    .sidebar-toggle-btn:active {
        transform: translateY(0);
        box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
    }

    /* Show panel-nav as a collapsible horizontal list */
    .panel-nav {
        display: none;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
        width: 100%;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .panel-nav.mobile-open {
        display: flex;
    }

    .panel-nav a {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        text-align: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
    }

    .panel-nav a span.dashicons {
        font-size: 0.9rem;
        width: 18px;
        height: 18px;
    }

    .logout-link {
        margin-top: 0 !important;
    }

    .user-mini-profile {
        display: none;
    }

    /* Panel Content Mobile */
    .panel-content {
        padding: 1rem;
        width: 100% !important;
        overflow-x: hidden;
    }

    .panel-header {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .panel-header h1 {
        font-size: 1.25rem;
    }

    /* Stats Grid - 2 columns on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    /* Proposal List Mobile */
    .proposal-card {
        padding: 1rem;
    }

    .proposal-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .proposal-right {
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }

    .proposal-right .btn,
    .proposal-card .btn {
        width: 100%;
        box-sizing: border-box;
    }

    .proposal-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Table Responsive */
    .proposal-list-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    .kd-table {
        min-width: 600px;
        font-size: 0.8rem;
    }

    .kd-table th,
    .kd-table td {
        padding: 8px 10px !important;
        white-space: nowrap;
    }

    /* Filter Bar Mobile */
    .filter-bar {
        gap: 6px !important;
        flex-wrap: wrap !important;
    }

    .filter-bar a {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
    }

    .filter-bar select {
        min-width: 140px !important;
        font-size: 0.8rem !important;
    }

    /* Form layout on mobile */
    .kd-form-wrapper {
        padding: 1.5rem !important;
    }

    /* Tabs on mobile */
    .kd-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .kd-tabs button {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }

    /* Stepper overflow fix */
    .stepper-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* File Upload Styles */
.file-upload-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    /* Initial padding */
    background: #F8FAFC;
    border: 2px dashed #94A3B8;
    /* Darker dash */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    min-height: 200px;
}

.file-upload-label:hover,
.file-upload-label.drag-over {
    background: #EFF6FF;
    border-color: #2563EB;
    transform: scale(1.01);
    /* Subtle grow */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.file-upload-label.drag-over {
    background: #DBEAFE;
    /* Even darker on drag */
}

.upload-icon {
    font-size: 3.5rem;
    /* Larger icon */
    margin-bottom: 1rem;
    color: #64748B;
    transition: color 0.2s;
}

.file-upload-label:hover .upload-icon {
    color: #2563EB;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 0.25rem;
}

.upload-hint {
    display: block;
    font-size: 0.9rem;
    color: #64748B;
    margin-top: 0.5rem;
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #F1F5F9;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #334155;
    animation: fadeIn 0.3s ease;
}

.file-item .remove-file {
    margin-left: auto;
    color: #EF4444;
    cursor: pointer;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.file-item .remove-file:hover {
    background: #FEE2E2;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* New Stepper Progress Bar */
.stepper-wrapper {
    display: flex;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #F1F5F9;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.05));
    width: 100%;
}

.stepper-item {
    flex: 1;
    position: relative;
    background: #E0F2FE;
    /* Light Blue (Future/Inactive) */
    color: #1E293B;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    padding: 0 10px 0 25px;
    margin-right: -10px;
    /* Overlap for seamless arrow */
    clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%, 10% 50%);
    z-index: 1;
}

.stepper-item:first-child {
    padding-left: 10px;
    clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%);
    border-radius: 6px 0 0 6px;
    z-index: 5;
}

.stepper-item:nth-child(2) {
    z-index: 4;
}

.stepper-item:nth-child(3) {
    z-index: 3;
}

.stepper-item:nth-child(4) {
    z-index: 2;
}

.stepper-item:nth-child(5) {
    z-index: 1;
    margin-right: 0;
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 10% 50%);
    border-radius: 0 6px 6px 0;
}

.stepper-item.completed {
    background: #10B981;
    /* Green */
    color: white;
}

.stepper-item.active {
    background: #2563EB;
    /* Blue (Current) */
    color: white;
}

/* Mobile Responsive Stepper */
@media (max-width: 768px) {
    .stepper-wrapper {
        flex-direction: column;
        gap: 8px;
        filter: none;
    }

    .stepper-item {
        clip-path: none !important;
        margin: 0;
        padding: 12px;
        border-radius: 8px !important;
        justify-content: flex-start;
        text-align: left;
    }

    .stepper-item::before {
        content: '✓';
        display: block;
        margin-right: 10px;
        font-weight: bold;
    }

    .stepper-item:first-child::before {
        content: '✓';
    }
}

/* ===== CONTRACT MODAL ===== */
.kd-contract-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.kd-contract-modal.show {
    opacity: 1;
    visibility: visible;
}

.kd-contract-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.kd-contract-modal-container {
    position: relative;
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.kd-contract-modal.show .kd-contract-modal-container {
    transform: translateY(0) scale(1);
}

.kd-contract-modal-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: white;
    flex-shrink: 0;
}

.kd-contract-modal-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kd-contract-price {
    font-size: 0.95rem;
    color: #94a3b8;
}

.kd-contract-price strong {
    color: #60a5fa;
    font-size: 1.1rem;
}

.kd-contract-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    min-height: 300px;
    scroll-behavior: smooth;
}

.kd-contract-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #334155;
}

.kd-contract-content p {
    margin-bottom: 0.75rem;
    text-align: justify;
}

.kd-contract-content strong {
    color: #1e293b;
}

.kd-contract-scroll-indicator {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, #ffffff 40%);
    padding: 2rem 1rem 1rem;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    animation: bounceDown 1.5s infinite;
}

@keyframes bounceDown {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(5px);
    }
}

.kd-contract-modal-footer {
    padding: 1.25rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.kd-contract-btn {
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.kd-contract-btn-reject {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.kd-contract-btn-reject:hover {
    background: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.15);
}

.kd-contract-btn-approve {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.kd-contract-btn-approve.active,
.kd-contract-btn-approve:not([disabled]) {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.kd-contract-btn-approve.active:hover,
.kd-contract-btn-approve:not([disabled]):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .kd-contract-modal-container {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .kd-contract-modal-header {
        padding: 1rem 1.25rem;
    }

    .kd-contract-modal-header h2 {
        font-size: 1rem;
    }

    .kd-contract-modal-body {
        padding: 1.25rem;
    }

    .kd-contract-content {
        font-size: 0.85rem;
    }

    .kd-contract-modal-footer {
        padding: 1rem;
        flex-direction: column;
    }

    .kd-contract-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
}