/* Construction Site Manager - Frontend Styles */

/* General Layout */
.csm-dashboard,
.csm-form-container,
.csm-site-selector,
.csm-reports-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Dashboard Styles */
.csm-dashboard-header {
    background: linear-gradient(135deg, #3fcc46 0%, #2db039 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(63, 204, 70, 0.3);
}

.csm-dashboard-header h2 {
    margin: 0 0 15px 0;
    font-size: 2.5em;
    font-weight: 300;
}

.csm-site-info {
    font-size: 1.2em;
    opacity: 0.9;
}

.csm-dashboard-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

.csm-quick-actions {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.csm-quick-actions h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.3em;
}

.csm-recent-activity {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.csm-recent-activity h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.3em;
}

/* Button Styles */
.csm-btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 5px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 120px;
}

.csm-btn-primary {
    background: linear-gradient(135deg, #3fcc46 0%, #2db039 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(63, 204, 70, 0.2);
}

.csm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(63, 204, 70, 0.4);
    background: linear-gradient(135deg, #2db039 0%, #239632 100%);
}

.csm-btn-secondary {
    background: #6c757d;
    color: white;
}

.csm-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.csm-btn-danger {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
    min-width: auto;
}

.csm-btn-danger:hover {
    background: #c82333;
}

/* Form Styles */
.csm-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.csm-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3fcc46 0%, #2db039 100%);
}

.csm-form h2 {
    margin: 0 0 30px 0;
    color: #2d3748;
    font-size: 2em;
    font-weight: 600;
    text-align: center;
    border-bottom: 3px solid #3fcc46;
    padding-bottom: 15px;
    background: linear-gradient(135deg, #3fcc46 0%, #2db039 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.csm-form-group {
    margin-bottom: 25px;
}

.csm-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
    position: relative;
}

.csm-form-group label:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3fcc46;
    transition: width 0.3s ease;
}

.csm-form-group:focus-within label:after {
    width: 30px;
}

.csm-form-group input,
.csm-form-group select,
.csm-form-group textarea {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #f8fafc;
    color: #2d3748;
}

.csm-form-group input:focus,
.csm-form-group select:focus,
.csm-form-group textarea:focus {
    outline: none;
    border-color: #3fcc46;
    box-shadow: 0 0 0 3px rgba(63, 204, 70, 0.15);
    background: white;
    transform: translateY(-1px);
}

.csm-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.csm-form-actions {
    text-align: center;
    margin-top: 30px;
    padding: 25px 20px 20px;
    border-top: 1px solid #e2e8f0;
    background: linear-gradient(135deg, rgba(63, 204, 70, 0.05) 0%, rgba(45, 176, 57, 0.05) 100%);
    border-radius: 0 0 10px 10px;
    margin-left: -30px;
    margin-right: -30px;
    margin-bottom: -30px;
}

/* Photo Upload Styles */
.csm-photo-upload {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    transition: border-color 0.3s ease;
}

.csm-photo-upload:hover {
    border-color: #667eea;
}

.csm-photo-upload input[type="file"] {
    border: none;
    background: transparent;
    padding: 0;
}

.csm-photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.csm-photo-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.csm-photo-item img {
    border-radius: 4px;
    margin-bottom: 8px;
}

.csm-photo-item span {
    display: block;
    font-size: 12px;
    color: #6c757d;
    word-break: break-word;
}

/* Dynamic List Styles */
.csm-dynamic-list {
    margin-bottom: 15px;
}

.csm-employee-hour-entry,
.csm-vehicle-usage-entry,
.csm-material-usage-entry,
.csm-work-type-entry {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(255, 255, 255, 0.9) 100%);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.csm-employee-hour-entry:hover,
.csm-vehicle-usage-entry:hover,
.csm-material-usage-entry:hover,
.csm-work-type-entry:hover {
    border-color: #3fcc46;
    box-shadow: 0 4px 20px rgba(63, 204, 70, 0.1);
    transform: translateY(-2px);
}

.csm-employee-hour-entry select,
.csm-vehicle-usage-entry select,
.csm-material-usage-entry select,
.csm-work-type-entry select {
    margin-bottom: 15px;
}

.csm-employee-hour-entry input,
.csm-vehicle-usage-entry input,
.csm-material-usage-entry input,
.csm-work-type-entry input {
    margin-bottom: 15px;
}

.csm-employee-hour-entry textarea,
.csm-vehicle-usage-entry textarea,
.csm-material-usage-entry textarea,
.csm-work-type-entry textarea {
    margin-bottom: 15px;
}

button.csm-remove-entry,
.csm-remove-entry {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    z-index: 1000 !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 32px !important;
    text-align: center !important;
    line-height: 1 !important;
    pointer-events: auto !important;
    outline: none !important;
}

button.csm-remove-entry:hover,
.csm-remove-entry:hover {
    background: linear-gradient(135deg, #ff3742 0%, #ff2731 100%) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4) !important;
}

/* Site Selector Styles */
.csm-site-selector {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.csm-site-selector h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.5em;
}

.csm-site-dropdown {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 20px;
}

.csm-selected-site-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.csm-selected-site-info h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.csm-selected-site-info p {
    margin: 5px 0;
    color: #6c757d;
}

/* Reports Styles */
.csm-report-filters {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.csm-report-results {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.csm-report-results h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.5em;
}

.csm-report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.csm-report-table th,
.csm-report-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.csm-report-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.csm-report-table td {
    color: #495057;
    font-size: 14px;
}

.csm-report-table tr:hover {
    background: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .csm-dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .csm-report-filters {
        grid-template-columns: 1fr;
    }

    .csm-form {
        padding: 20px;
    }

    .csm-dashboard-header {
        padding: 20px;
    }

    .csm-dashboard-header h2 {
        font-size: 2em;
    }

    .csm-btn {
        width: 100%;
        margin: 5px 0;
    }

    .csm-photo-preview {
        justify-content: center;
    }
}

@media (max-width: 480px) {

    .csm-dashboard,
    .csm-form-container,
    .csm-site-selector,
    .csm-reports-container {
        padding: 15px;
    }

    .csm-form {
        padding: 15px;
    }

    .csm-dashboard-header {
        padding: 15px;
    }

    .csm-dashboard-header h2 {
        font-size: 1.8em;
    }
}

/* Loading States */
.csm-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.csm-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Success/Error Messages */
.csm-message {
    padding: 15px 20px;
    border-radius: 6px;
    margin: 20px 0;
    font-weight: 500;
}

.csm-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.csm-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Status Indicators */
.csm-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.csm-status-active {
    background: #d4edda;
    color: #155724;
}

.csm-status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.csm-status-pending {
    background: #fff3cd;
    color: #856404;
}

/* FilePond Photo Upload */
.csm-filepond-container {
    margin-bottom: 20px;
}

.csm-url-input-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.csm-url-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.csm-url-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.csm-url-input-container .csm-btn {
    white-space: nowrap;
    padding: 10px 15px;
    height: auto;
    line-height: 1.2;
}

.csm-filepond-container .filepond--root {
    font-family: inherit;
    font-size: 14px;
}

.csm-filepond-container .filepond--panel-root {
    background-color: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.csm-filepond-container .filepond--root:hover .filepond--panel-root {
    border-color: #0073aa;
}

.csm-filepond-container .filepond--drop-label {
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

.csm-filepond-container .filepond--label-action {
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
}

.csm-filepond-container .filepond--item {
    border-radius: 6px;
    overflow: hidden;
}

.csm-filepond-container .filepond--image-preview {
    border-radius: 6px;
}

.csm-filepond-container .filepond--file-info {
    font-size: 12px;
}

.csm-filepond-container .filepond--progress-indicator {
    background-color: #0073aa;
}

/* Responsive FilePond */
@media (max-width: 768px) {
    .csm-filepond-container .filepond--drop-label {
        font-size: 14px;
    }

    .csm-filepond-container .filepond--root {
        font-size: 12px;
    }
}

/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {

    /* Dashboard responsive */
    .csm-dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .csm-dashboard-header {
        padding: 20px;
    }

    .csm-dashboard-header h2 {
        font-size: 2em;
    }

    /* Form responsive */
    .csm-form-container {
        padding: 15px;
    }

    .csm-employee-hour-entry,
    .csm-vehicle-usage-entry,
    .csm-material-usage-entry,
    .csm-work-type-entry {
        padding: 15px;
        margin-bottom: 10px;
    }

    /* Fix remove button positioning on mobile */
    .csm-remove-entry {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto;
        margin: 0;
        padding: 6px 10px;
        font-size: 11px;
        background: #dc3545;
        color: white;
        border: none;
        border-radius: 3px;
        cursor: pointer;
        transition: background-color 0.3s ease;
        z-index: 10;
    }

    .csm-remove-entry:hover {
        background: #c82333;
    }

    /* Ensure proper spacing between form elements */
    .csm-employee-hour-entry select,
    .csm-vehicle-usage-entry select,
    .csm-material-usage-entry select,
    .csm-work-type-entry select,
    .csm-employee-hour-entry input,
    .csm-vehicle-usage-entry input,
    .csm-material-usage-entry input,
    .csm-work-type-entry input,
    .csm-employee-hour-entry textarea,
    .csm-vehicle-usage-entry textarea,
    .csm-material-usage-entry textarea,
    .csm-work-type-entry textarea {
        margin-bottom: 15px;
        width: 100%;
        box-sizing: border-box;
        padding-right: 80px;
        /* Make space for remove button */
    }

    /* Button responsive */
    .csm-btn {
        width: 100%;
        margin: 5px 0;
        padding: 15px 20px;
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    /* Site selector responsive */
    .csm-site-selector {
        padding: 20px;
    }

    .csm-site-dropdown {
        font-size: 16px;
        /* Prevent zoom on iOS */
        padding: 12px;
    }

    /* Report filters responsive */
    .csm-report-filters {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
}

@media (max-width: 480px) {

    /* Extra small devices */
    .csm-dashboard,
    .csm-form-container,
    .csm-site-selector,
    .csm-reports-container {
        padding: 10px;
    }

    .csm-dashboard-header {
        padding: 15px;
    }

    .csm-dashboard-header h2 {
        font-size: 1.8em;
    }

    .csm-employee-hour-entry,
    .csm-vehicle-usage-entry,
    .csm-material-usage-entry,
    .csm-work-type-entry {
        padding: 12px;
    }

    /* Ensure remove button is clearly visible */
    .csm-remove-entry {
        position: absolute;
        top: 6px;
        right: 6px;
        width: auto;
        margin: 0;
        padding: 5px 8px;
        font-size: 10px;
        background: #dc3545;
        color: white;
        border: none;
        border-radius: 3px;
        cursor: pointer;
        transition: background-color 0.3s ease;
        z-index: 10;
    }

    .csm-remove-entry:hover {
        background: #c82333;
    }

    /* Form labels and inputs */
    .csm-form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
    }

    .csm-form-group input,
    .csm-form-group select,
    .csm-form-group textarea {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

/* Add styling for dynamic list add buttons */
button[onclick*="csmAdd"],
button[onclick*="Add"] {
    background: linear-gradient(135deg, #3fcc46 0%, #2db039 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 3px 12px rgba(63, 204, 70, 0.3) !important;
    transition: all 0.3s ease !important;
    margin: 10px 0 !important;
    cursor: pointer !important;
}

button[onclick*="csmAdd"]:hover,
button[onclick*="Add"]:hover {
    background: linear-gradient(135deg, #2db039 0%, #239632 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 18px rgba(63, 204, 70, 0.4) !important;
}

/* Form section headers */
.csm-form h3,
.csm-form-group>strong {
    color: #2d3748;
    border-left: 4px solid #3fcc46;
    padding-left: 15px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Comprehensive Daily Report Styles */
.csm-comprehensive-reports {
    margin-top: 20px;
}

.csm-daily-report-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.csm-daily-report-item h3 {
    color: #2d3748;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #3fcc46;
    font-size: 18px;
    background: linear-gradient(135deg, #3fcc46 0%, #2db039 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.csm-report-basic-info {
    margin-bottom: 20px;
}

.csm-report-basic-info table {
    width: 100%;
    background: white;
    border-radius: 4px;
}

.csm-report-basic-info th {
    background: linear-gradient(135deg, #3fcc46 0%, #2db039 100%);
    color: white;
    font-weight: 600;
    width: 150px;
    text-align: left;
}

.csm-report-basic-info td {
    padding: 10px 15px;
}

.csm-report-section {
    margin: 15px 0;
    background: white;
    border-radius: 6px;
    padding: 15px;
    border-left: 4px solid #3fcc46;
    box-shadow: 0 2px 8px rgba(63, 204, 70, 0.1);
}

.csm-report-section h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.csm-report-section p {
    color: #666;
    font-style: italic;
    margin: 5px 0;
}

.csm-report-section table {
    width: 100%;
    margin-top: 10px;
}

.csm-report-section th {
    background: #f1f3f4;
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.csm-report-section td {
    font-size: 14px;
    padding: 8px 12px;
}

/* Report summary styling */
.csm-report-basic-info td:last-child {
    font-weight: 500;
    color: #3fcc46;
}