/* Teklif Eklentisi Frontend Styles */

/* Ana wrapper */
.teklif-plugin-wrapper {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #1f2937;
    line-height: 1.6;
}

/* Mevcut HTML'den alınan stiller */
.proposal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.proposal-section {
    background-color: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.06), 0 2px 8px -3px rgba(0, 0, 0, 0.03);
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.section-content {
    margin-top: 1.5rem;
    transition: max-height 0.5s ease-in-out, opacity 0.3s ease, margin-top 0.3s ease;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
}

.section-content.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-icon.rotated {
    transform: rotate(-180deg);
}

.editable-text {
    outline: none;
    border-bottom: 1px dotted #9ca3af;
    transition: border-color 0.2s ease-in-out;
    font-weight: 500;
}

.editable-text:hover, 
.editable-text:focus {
    border-bottom-color: #6b7280;
}

.input-field {
    padding: 0.6rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.total-amount-box {
    background-color: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 0.8rem 1.2rem;
    border-radius: 0.5rem;
}

/* Loading ve Modal */
.loading-overlay, 
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    font-size: 1.5rem;
    flex-direction: column;
    gap: 1rem;
    backdrop-filter: blur(4px);
}

.spinner {
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mesaj kutusu */
.message-box {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background-color: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
    font-weight: 500;
}

.message-box.error {
    background-color: #ef4444;
}

.message-box.show {
    opacity: 1;
    transform: translateY(0);
}

/* Logo preview */
#company-logo-preview, 
.sub-logo-preview {
    max-width: 120px;
    max-height: 120px;
    margin-bottom: 1rem;
    display: none;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.sub-logo-item {
    position: relative;
}

.remove-sub-logo-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Modal */
.modal-content {
    background: white;
    color: #1f2937;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.hidden {
    display: none !important;
}

/* Responsive tasarım */
@media (max-width: 768px) {
    .proposal-container {
        padding: 10px;
    }
    
    .proposal-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .section-header h3 {
        font-size: 1.1rem;
    }
    
    .input-field {
        font-size: 16px; /* iOS zoom önleme */
    }
    
    .message-box {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        padding: 0.8rem 1rem;
    }
}

/* Teklif onay sayfası */
.teklif-onay-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.teklif-onay-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
}

.teklif-onay-header h1 {
    color: #1f2937;
    margin-bottom: 10px;
}

.teklif-info {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
}

.teklif-onay-actions {
    text-align: center;
    margin: 30px 0;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 0 10px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

/* Status badges */
.teklif-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.teklif-badge-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.teklif-badge-approved {
    background-color: #d1fae5;
    color: #065f46;
}

.teklif-badge-rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Mesaj gösterimi */
.teklif-message {
    padding: 12px 16px;
    margin: 20px 0;
    border-radius: 6px;
    font-weight: 500;
}

.teklif-message-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.teklif-message-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Tablo responsive */
.teklif-table-responsive {
    overflow-x: auto;
    margin: 10px 0;
}

.teklif-table-responsive table {
    min-width: 100%;
    white-space: nowrap;
}

/* Ürün arama dropdown */
.product-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.product-search-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.product-search-item:hover {
    background-color: #f8fafc;
}

.product-search-item:last-child {
    border-bottom: none;
}

.product-search-item .product-name {
    font-weight: 500;
    color: #1f2937;
}

.product-search-item .product-price {
    font-size: 0.875rem;
    color: #6b7280;
}

.product-search-item .product-type {
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
}

/* Loading state for buttons */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Teklif Onay Sayfası Stilleri */
.teklif-approval-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.approval-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.company-info h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.company-slogan {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 14px;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.status-bekleyen { background: #fef3c7; color: #d97706; }
.status-onaylandi { background: #dcfce7; color: #16a34a; }
.status-reddedildi { background: #fee2e2; color: #dc2626; }

.proposal-details {
    padding: 30px;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h2 {
    color: #1f2937;
    font-size: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
}

.info-item label {
    font-weight: 600;
    color: #374151;
}

/* Teklif Kalemleri */
.proposal-items {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.proposal-items h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.items-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.items-table th, .items-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.items-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.items-table tbody tr:hover {
    background-color: #f8f9fa;
}

.items-table .total-row {
    background-color: #667eea;
    color: white;
    font-size: 1.1em;
}

.items-table .total-row td {
    border-bottom: none;
    padding: 15px 12px;
}

/* Şartlar ve Notlar */
.proposal-terms, .proposal-notes {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.proposal-terms h2, .proposal-notes h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.terms-content, .notes-content {
    line-height: 1.6;
    color: #555;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.approval-actions {
    padding: 30px;
    background: #f8fafc;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-approve {
    background: #16a34a;
    color: white;
}

.btn-approve:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.btn-reject {
    background: #dc2626;
    color: white;
}

.btn-reject:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-download {
    background: #2563eb;
    color: white;
}

.btn-contact {
    background: #6b7280;
    color: white;
}

.action-note {
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}

.success-message,
.error-message {
    margin-bottom: 20px;
}

.success-message h3 {
    color: #16a34a;
    margin-bottom: 5px;
}

.error-message h3 {
    color: #dc2626;
    margin-bottom: 5px;
}

.approval-footer {
    background: #1f2937;
    color: white;
    padding: 20px 30px;
    text-align: center;
}

.approval-footer h4 {
    margin-bottom: 10px;
    color: #f3f4f6;
}

.teklif-error {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    text-align: center;
    background: #fee2e2;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

.teklif-error h2 {
    color: #dc2626;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .approval-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Hata Sayfası Stilleri */
.teklif-error {
    max-width: 600px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.teklif-error h2 {
    color: #dc2626;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.teklif-error p {
    color: #666;
    margin-bottom: 10px;
}

.teklif-error a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.teklif-error a:hover {
    text-decoration: underline;
}

/* Admin olmayan kullanıcılar için kilitli alanlar */
.editable-text[contenteditable="false"] {
    background-color: #f3f4f6 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    position: relative;
}

.editable-text[contenteditable="false"]:hover::after {
    content: "🔒 Bu alanı sadece admin değiştirebilir";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/* ========================================
   WooCommerce Customer Panel Styles
   ======================================== */

.teklif-customer-panel {
    max-width: 1200px;
}

.back-to-all-proposals {
    margin-bottom: 20px;
}

/* Accordion Styles */
.proposals-accordion {
    margin-top: 20px;
}

.proposal-accordion-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.proposal-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.3s ease;
}

.proposal-accordion-header:hover {
    background: #e9ecef;
}

.proposal-accordion-header.active {
    background: #667eea;
    color: white;
}

.proposal-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-right: 20px;
}

.proposal-title h3 {
    margin: 0 0 5px 0;
    color: inherit;
    font-size: 1.2em;
    font-weight: 600;
}

.proposal-date {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 2px;
}

.proposal-accordion-header.active .proposal-date {
    color: rgba(255, 255, 255, 0.8);
}

.proposal-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.proposal-amount {
    font-size: 1.1em;
    font-weight: 600;
    color: #28a745;
}

.proposal-accordion-header.active .proposal-amount {
    color: #fff;
}

.accordion-toggle {
    margin-left: 15px;
}

.toggle-icon {
    font-size: 1.2em;
    transition: transform 0.3s ease;
    display: inline-block;
}

.proposal-accordion-header.active .toggle-icon {
    transform: rotate(180deg);
}

.proposal-accordion-content {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.proposal-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-bekleyen {
    background: #fef3c7;
    color: #d97706;
}

.status-onaylandi {
    background: #dcfce7;
    color: #16a34a;
}

.status-reddedildi {
    background: #fee2e2;
    color: #dc2626;
}

.proposal-details {
    display: grid;
    gap: 10px;
    margin-bottom: 15px;
}

.proposal-details p {
    margin: 5px 0;
    color: #666;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 4px;
}

.proposal-detail-content {
    margin-top: 20px;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

/* WooCommerce customer panel içindeki shortcode stilleri */
.teklif-customer-panel .teklif-approval-container {
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
}

.teklif-customer-panel .proposal-header-info {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.teklif-customer-panel .proposal-items-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.teklif-customer-panel .approval-actions {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.teklif-customer-panel .action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.teklif-customer-panel .btn {
    min-width: 150px;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.teklif-customer-panel .btn-approve {
    background: #28a745;
    color: white;
    border: 2px solid #28a745;
}

.teklif-customer-panel .btn-approve:hover {
    background: #218838;
    border-color: #218838;
}

.teklif-customer-panel .btn-reject {
    background: #dc3545;
    color: white;
    border: 2px solid #dc3545;
}

.teklif-customer-panel .btn-reject:hover {
    background: #c82333;
    border-color: #c82333;
}

/* Customer panel içindeki teklif tabloları */
.teklif-customer-panel .proposal-items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.teklif-customer-panel .proposal-items-table th,
.teklif-customer-panel .proposal-items-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.teklif-customer-panel .proposal-items-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.teklif-customer-panel .proposal-totals {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

.teklif-customer-panel .totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: center;
}

.teklif-customer-panel .total-row {

    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.teklif-customer-panel .total-row:last-child {
    border-bottom: none;

}

/* Customer panel içindeki PDF ve WhatsApp butonları */
.teklif-customer-panel .additional-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.teklif-customer-panel .btn-pdf,
.teklif-customer-panel .btn-whatsapp {
    background: #6c757d;
    color: white;
    border: 2px solid #6c757d;
    min-width: 120px;
}

.teklif-customer-panel .btn-pdf:hover,
.teklif-customer-panel .btn-whatsapp:hover {
    background: #545b62;
    border-color: #545b62;
    color: white;
}

/* WooCommerce Customer Panel Responsive */
@media (max-width: 768px) {
    .proposal-accordion-header {
        padding: 15px;
    }
    
    .proposal-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-right: 10px;
    }
    
    .proposal-title h3 {
        font-size: 1.1em;
    }
    
    .proposal-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .proposal-amount {
        font-size: 1em;
    }
    
    .accordion-toggle {
        margin-left: 10px;
    }
    
    .teklif-customer-panel .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .teklif-customer-panel .btn {
        min-width: auto;
        width: 100%;
    }
    
    .teklif-customer-panel .totals-grid {
        grid-template-columns: 1fr;
    }
    
    .teklif-customer-panel .additional-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .teklif-customer-panel .btn-pdf,
    .teklif-customer-panel .btn-whatsapp {
        width: 100%;
        min-width: auto;
    }
    
    .teklif-customer-panel .proposal-items-table {
        font-size: 14px;
    }
    
    .teklif-customer-panel .proposal-items-table th,
    .teklif-customer-panel .proposal-items-table td {
        padding: 8px;
    }
}
