/**
 * Site Advertising Manager - Frontend Styles
 *
 * @package SiteAdvertisingManager
 */

/* ==========================================================================
   Shortcode Display - Grid Layout
   ========================================================================== */

.sam-advertisements {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.sam-advertisements.sam-columns-1 {
    grid-template-columns: 1fr;
}

.sam-advertisements.sam-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.sam-advertisements.sam-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.sam-advertisements.sam-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive grid */
@media (max-width: 768px) {
    .sam-advertisements.sam-columns-3,
    .sam-advertisements.sam-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .sam-advertisements.sam-columns-2,
    .sam-advertisements.sam-columns-3,
    .sam-advertisements.sam-columns-4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Advertisement Card
   ========================================================================== */

.sam-advertisement {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.sam-advertisement:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sam-ad-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.sam-ad-content {
    display: flex;
    flex-direction: column;
}

/* Banner type only */
.sam-type-banner .sam-ad-logo {
    display: none;
}

/* Logo type only */
.sam-type-logo .sam-ad-banner {
    display: none;
}

/* ==========================================================================
   Advertisement Images
   ========================================================================== */

.sam-ad-banner {
    width: 100%;
    overflow: hidden;
}

.sam-banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.sam-ad-logo {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sam-logo-image {
    max-width: 150px;
    max-height: 80px;
    height: auto;
}

.sam-ad-title {
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

/* ==========================================================================
   BuddyPress Profile - View Tab
   ========================================================================== */

.sam-profile-advertisement {
    max-width: 800px;
}

.sam-status-box {
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    background: #f9f9f9;
    border-left: 4px solid #ccc;
}

.sam-status-box h3 {
    margin: 0 0 15px;
    font-size: 18px;
}

.sam-status-box p {
    margin: 8px 0;
}

/* Status colors */
.sam-status-pending,
.sam-status-box.sam-status-pending {
    border-left-color: #f0ad4e;
    background: #fcf8e3;
}

.sam-status-publish,
.sam-status-box.sam-status-publish {
    border-left-color: #5cb85c;
    background: #dff0d8;
}

.sam-status-expired,
.sam-status-box.sam-status-expired {
    border-left-color: #d9534f;
    background: #f2dede;
}

.sam-status-label span {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}

.sam-status-label .sam-status-pending {
    background: #f0ad4e;
    color: #fff;
}

.sam-status-label .sam-status-publish {
    background: #5cb85c;
    color: #fff;
}

.sam-status-label .sam-status-expired {
    background: #d9534f;
    color: #fff;
}

.sam-status-note {
    font-style: italic;
    color: #666;
    border-top: 1px dashed #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

/* ==========================================================================
   BuddyPress Profile - Ad Preview
   ========================================================================== */

.sam-ad-preview {
    margin-bottom: 30px;
}

.sam-ad-preview h3 {
    margin: 0 0 20px;
    font-size: 18px;
}

.sam-preview-details {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.sam-preview-details p {
    margin: 8px 0;
}

.sam-preview-banner,
.sam-preview-logo {
    margin-bottom: 20px;
}

.sam-preview-banner h4,
.sam-preview-logo h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #666;
}

.sam-banner-preview {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.sam-logo-preview {
    max-width: 200px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.sam-no-content {
    color: #888;
    font-style: italic;
}

.sam-no-content a {
    display: block;
    margin-top: 10px;
}

/* ==========================================================================
   BuddyPress Profile - Actions
   ========================================================================== */

.sam-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.sam-expired-notice {
    padding: 20px;
    background: #f2dede;
    border-radius: 8px;
    text-align: center;
}

.sam-expired-notice p {
    margin: 0 0 15px;
    color: #a94442;
}

/* ==========================================================================
   BuddyPress Profile - Edit Form
   ========================================================================== */

.sam-edit-form-container {
    max-width: 600px;
}

.sam-edit-form-container h3 {
    margin: 0 0 25px;
    font-size: 20px;
}

.sam-edit-form {
    background: #fff;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.sam-form-field {
    margin-bottom: 25px;
}

.sam-form-field > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.sam-form-field input[type="text"],
.sam-form-field input[type="url"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.sam-form-field input[type="text"]:focus,
.sam-form-field input[type="url"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Image upload fields */
.sam-image-field {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.sam-image-preview {
    min-height: 60px;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff;
    border: 2px dashed #ddd;
    border-radius: 4px;
    text-align: center;
}

.sam-image-preview img {
    max-width: 100%;
    max-height: 150px;
    height: auto;
}

.sam-image-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sam-upload-option,
.sam-url-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sam-upload-option label,
.sam-url-option label {
    font-size: 13px;
    color: #666;
}

.sam-or-divider {
    text-align: center;
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.sam-remove-image {
    margin-top: 10px;
    padding: 6px 12px;
    background: #d9534f;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.sam-remove-image:hover {
    background: #c9302c;
}

/* Form actions */
.sam-form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.sam-submit-btn {
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.sam-submit-btn:hover {
    background: #005a87;
}

.sam-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.sam-form-status {
    font-size: 14px;
}

.sam-form-status.success {
    color: #5cb85c;
}

.sam-form-status.error {
    color: #d9534f;
}

.sam-edit-notice {
    margin-top: 20px;
    padding: 15px;
    background: #d9edf7;
    border-radius: 8px;
    font-size: 13px;
    color: #31708f;
}

.sam-edit-disabled {
    padding: 30px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 8px;
    color: #666;
}

/* ==========================================================================
   No Advertisement State
   ========================================================================== */

.sam-no-advertisement {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.sam-no-advertisement h3 {
    margin: 0 0 15px;
    font-size: 20px;
    color: #333;
}

.sam-no-advertisement p {
    margin: 0 0 20px;
    color: #666;
}

.sam-no-advertisement .button {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
}

.sam-no-advertisement .button:hover {
    background: #005a87;
}

/* ==========================================================================
   WooCommerce Order Integration
   ========================================================================== */

.sam-order-ad-status {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.sam-order-ad-status .sam-status-pending {
    color: #8a6d3b;
}

.sam-order-ad-status .sam-status-publish {
    color: #3c763d;
}

.sam-order-ad-status .sam-status-expired {
    color: #a94442;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.sam-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.sam-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: sam-spin 0.8s linear infinite;
}

@keyframes sam-spin {
    to {
        transform: rotate(360deg);
    }
}
