// Name:            Table
// Description:     Defines styles for tables
//
// Component:       `wk-table`
//
// Modifiers:       `wk-table-middle`
//                  `wk-table-striped`
//                  `wk-table-condensed`
//                  `wk-table-hover`
//
// States:          `wk-active`
//
// ========================================================================


// Variables
// ========================================================================

@table-margin-vertical:                         15px;
@table-padding-vertical:                        8px;
@table-padding-horizontal:                      8px;

@table-caption-color:                           #999;
@table-caption-font-size:                       12px;

@table-striped-background:                      #f5f5f5;

@table-condensed-padding-vertical:              4px;
@table-condensed-padding-horizontal:            8px;

@table-hover-background:                        #EEE;

@table-active-background:                       @table-hover-background;


/* ========================================================================
   Component: Table
 ========================================================================== */

/*
 * 1. Remove most spacing between table cells.
 * 2. Block element behavior
 * 3. Style
 */

.wk-table {
    /* 1 */
    border-collapse: collapse;
    border-spacing: 0;
    /* 2 */
    width: 100%;
    /* 3 */
    margin-bottom: @table-margin-vertical;
}

/*
 * Add margin if adjacent element
 */

* + .wk-table { margin-top: @table-margin-vertical; }

.wk-table th,
.wk-table td {
    padding: @table-padding-vertical @table-padding-horizontal;
    .hook-table;
}

/*
 * Set alignment
 */

.wk-table th { text-align: left; }
.wk-table td { vertical-align: top; }

.wk-table thead th { vertical-align: bottom; }

/*
 * Caption and footer
 */

.wk-table caption,
.wk-table tfoot {
    font-size: @table-caption-font-size;
    font-style: italic;
}

.wk-table caption {
    text-align: left;
    color: @table-caption-color;
}

/*
 * Active State
 */

.wk-table tbody tr.wk-active {
    background: @table-active-background;
    .hook-table-active;
}


/* Sub-modifier: `wk-table-middle`
 ========================================================================== */

.wk-table-middle,
.wk-table-middle td { vertical-align: middle !important; }


/* Modifier: `wk-table-striped`
 ========================================================================== */

.wk-table-striped tbody tr:nth-of-type(odd) {
    background: @table-striped-background;
    .hook-table-striped;
}


/* Modifier: `wk-table-condensed`
 ========================================================================== */

.wk-table-condensed td {
    padding: @table-condensed-padding-vertical @table-condensed-padding-horizontal;
    .hook-table-condensed;
}


/* Modifier: `wk-table-hover`
 ========================================================================== */

.wk-table-hover tbody tr:hover {
    background: @table-hover-background;
    .hook-table-hover;
}



// Hooks
// ========================================================================

.hook-table-misc;

.hook-table() {}
.hook-table-active() {}
.hook-table-striped() {}
.hook-table-condensed() {}
.hook-table-hover() {}
.hook-table-misc() {}