/**
 * Google Sheets Integration - Advanced Editor Styles
 * Enterprise-level styling for full Google Sheets functionality
 * 
 * @package LOADS MANAGEMENT
 * @version 4.0.0-Enterprise
 * @author Web App Developer
 */

/* ===== PERFORMANCE: LAZY DROPDOWN STYLES ===== */
.gsi-has-dropdown-pending {
    cursor: pointer;
    background: #fafafa !important;
    transition: background-color 0.15s ease;
}

.gsi-has-dropdown-pending:hover {
    background: #f0f0f0 !important;
}

/* ===== ADVANCED TOOLBAR ===== */
.gsi-advanced-toolbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gsi-toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.gsi-toolbar-section:last-child {
    border-right: none;
}

.gsi-toolbar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.gsi-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gsi-toolbar-btn.active {
    background: rgba(76, 175, 80, 0.8);
    border-color: rgba(76, 175, 80, 0.9);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.gsi-toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 8px;
}

/* ===== FORMULA BAR ===== */
.gsi-formula-bar {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.gsi-formula-bar:focus-within {
    border-color: #667eea;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.2);
}

.gsi-cell-address {
    min-width: 80px;
}

.gsi-cell-address input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    background: #f8f9fa;
    color: #495057;
}

.gsi-formula-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gsi-formula-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    background: #ffffff;
    transition: all 0.3s ease;
}

.gsi-formula-input input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.gsi-formula-btn {
    background: #667eea;
    border: none;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gsi-formula-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.gsi-formula-btn:last-child {
    background: #ff6b6b;
}

.gsi-formula-btn:last-child:hover {
    background: #ff5252;
}

/* ===== ADVANCED TABLE STYLING ===== */
.gsi-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    /* USUŃ KOLORY - POZWÓL GOOGLE SHEETS KONTROLOWAĆ */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.gsi-table th,
.gsi-table td {
    padding: 12px 16px;
    border-right: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    text-align: left;
    vertical-align: middle;
    position: relative;
    transition: all 0.3s ease;
}

.gsi-table th {
    /* USUŃ KOLORY - POZWÓL GOOGLE SHEETS KONTROLOWAĆ */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: none;
}

.gsi-table td {
    /* USUŃ KOLORY - POZWÓL GOOGLE SHEETS KONTROLOWAĆ */
    font-size: 14px;
    line-height: 1.5;
}

/* USUŃ NADPISANIA HOVER - POZWÓL GOOGLE SHEETS KONTROLOWAĆ KOLORY */
.gsi-table tbody tr:hover td { outline: none; }

.gsi-table tbody tr:last-child td {
    border-bottom: none;
}

.gsi-table td:last-child {
    border-right: none;
}

/* ===== CELL EDITING ===== */
.gsi-cell-editable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gsi-cell-editable:hover {
    /* Usuń nadpisywanie tła na hover, aby nie kolidować z kolorami z Google Sheets */
    border: 1px solid #667eea;
    border-radius: 4px;
}

.gsi-cell-selected {
    background: #e6f7ff !important;
    border: 2px solid #1890ff !important;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
    position: relative;
}

.gsi-cell-selected::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #1890ff;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.gsi-cell-editing {
    background: #ffffff !important;
    border: 2px solid #52c41a !important;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(82, 196, 26, 0.2);
    outline: none;
}

/* ===== FORMATTING CLASSES ===== */
.gsi-bold {
    font-weight: bold;
}

.gsi-italic {
    font-style: italic;
}

.gsi-underline {
    text-decoration: underline;
}

.gsi-strikethrough {
    text-decoration: line-through;
}

/* ===== ALIGNMENT CLASSES ===== */
.gsi-align-left {
    text-align: left;
}

.gsi-align-center {
    text-align: center;
}

.gsi-align-right {
    text-align: right;
}

.gsi-align-justify {
    text-align: justify;
}

/* ===== NOTIFICATIONS ===== */
.gsi-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 300px;
    font-weight: 600;
    animation: slideInRight 0.3s ease;
}

.gsi-notification-success {
    border-left: 4px solid #52c41a;
    background: #f6ffed;
    color: #389e0d;
}

.gsi-notification-error {
    border-left: 4px solid #ff4d4f;
    background: #ffffff;
    color: #cf1322;
}

.gsi-notification-info {
    border-left: 4px solid #1890ff;
    background: #e6f7ff;
    color: #0050b3;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== COMMENTS ===== */
.gsi-cell-comment {
    position: relative;
}

.gsi-cell-comment::after {
    content: '💬';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 12px;
    opacity: 0.7;
}

.gsi-comment-popup {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 250px;
    font-size: 14px;
    line-height: 1.5;
}

.gsi-comment-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
}

/* ===== CHARTS ===== */
.gsi-chart-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.gsi-chart-title {
    font-size: 18px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
}

.gsi-chart-content {
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
    font-size: 16px;
}

/* ===== FILTERS ===== */
.gsi-filter-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.gsi-filter-title {
    font-size: 16px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 15px;
}

.gsi-filter-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.gsi-filter-select {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    min-width: 120px;
}

.gsi-filter-input {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
}

.gsi-filter-btn {
    background: #667eea;
    border: none;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.gsi-filter-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* ===== CONDITIONAL FORMATTING ===== */
.gsi-conditional-formatting {
    background: #ffffff;
    border: 1px solid #ffd591;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #d46b08;
}

.gsi-conditional-formatting.high {
    background: #ffffff;
    border-color: #ffccc7;
    color: #cf1322;
}

.gsi-conditional-formatting.medium {
    background: #ffffff;
    border-color: #ffd591;
    color: #d46b08;
}

.gsi-conditional-formatting.low {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #389e0d;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .gsi-advanced-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .gsi-toolbar-section {
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        padding: 10px 0;
    }
    
    .gsi-toolbar-section:last-child {
        border-bottom: none;
    }
    
    .gsi-formula-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .gsi-cell-address {
        min-width: auto;
    }
    
    .gsi-formula-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .gsi-formula-input input {
        width: 100%;
    }
    
    .gsi-table {
        font-size: 12px;
    }
    
    .gsi-table th,
    .gsi-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .gsi-advanced-toolbar {
        padding: 10px 15px;
    }
    
    .gsi-toolbar-btn {
        min-width: 32px;
        height: 32px;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .gsi-formula-bar {
        padding: 10px 15px;
    }
    
    .gsi-table {
        font-size: 11px;
    }
    
    .gsi-table th,
    .gsi-table td {
        padding: 6px 8px;
    }
}

/* ===== ACCESSIBILITY ===== */
.gsi-toolbar-btn:focus,
.gsi-formula-btn:focus,
.gsi-cell-editable:focus {
    outline: 2px solid #1890ff;
    outline-offset: 2px;
}

.gsi-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gsi-toolbar-btn:disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gsi-table tbody tr {
    animation: fadeIn 0.3s ease;
}

.gsi-cell-editing {
    animation: fadeIn 0.2s ease;
}

/* ===== LOADING STATES ===== */
.gsi-loading {
    position: relative;
    pointer-events: none;
}

.gsi-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* USUŃ DARK MODE - POZWÓL GOOGLE SHEETS KONTROLOWAĆ KOLORY */
